Part Number Hot Search : 
TC220C P1500 PE4527 TFS210D WP1154GT IDTVS330 SCS130P 10100C
Product Description
Full Text Search
 

To Download W65C816S Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  the western design center, inc. updated june 14, 2004 W65C816S data she et ? the western design center, inc., 2004. all rights reserved wdc W65C816S microprocessor data sheet
the western design center, inc. W65C816S data sheet the western design center W65C816S 2 wdc reserves the right to make changes at any time without notice in order to improve design and supply the best possible product. information contained herein is provided gratuitously and without liability, to any user. reasonable efforts have been made to verify accuracy of the information but no guarantee whatsoever is given as to the accuracy or as to its applicability to particular uses. in every instance, it must be the responsibility of the user to d etermine the suitability of the products for each application. wdc products are not authorized for use as critical components in life support devices or systems. nothing contained herein shall be construed as a recommendation to use any product in violat ion of existing patents or other rights of third parties. the sale of any wdc product is subject to all wdc terms and conditions of sales and sales policies, copies of which are available upon request. copyright (c) 1981 - 2004 by the western design center , inc. all rights reserved, including the right of reproduction in whole or in part in any form.
the western design center, inc. W65C816S data sheet the western design center W65C816S 3 table of contents 1 introduction ................................ ................................ ................................ ........................... 7 2 W65C816S functional description ................................ ................................ ................. 8 2.1 instru ction register (ir) ................................ ................................ ................................ .......... 8 2.2 timing control unit (tcu) ................................ ................................ ................................ ...... 8 2.3 arithmetic and logic unit (alu) ................................ ................................ ............................. 8 2.4 internal registers (refer to programming model table 2 - 2) ................................ ................... 8 2.5 accumulator (a) ................................ ................................ ................................ ....................... 8 2.6 data bank register (dbr) ................................ ................................ ................................ ....... 9 2.7 direct (d) ................................ ................................ ................................ ................................ . 9 2.8 index (x and y) ................................ ................................ ................................ ........................ 9 2.9 processor status register (p ) ................................ ................................ ................................ .... 9 2.10 program bank register (pbr) ................................ ................................ ................................ . 9 2.11 program counter (pc) ................................ ................................ ................................ ........... 10 2.12 stack pointer (s) ................................ ................................ ................................ .................... 10 3 pin function description ................................ ................................ ............................... 13 3.1 abort (abortb) ................................ ................................ ................................ ................... 16 3.2 address bus (a0 - a15) ................................ ................................ ................................ ............ 16 3.3 bus enable (be) ................................ ................................ ................................ ..................... 16 3.4 data/bank address bus (d0 - d7) ................................ ................................ ............................ 16 3.5 emulation sta tus (e) ................................ ................................ ................................ .............. 17 3.6 interrupt request (irqb) ................................ ................................ ................................ ...... 17 3.7 memory lock (mlb) ................................ ................................ ................................ ............. 17 3.8 memory/index select status (mx) ................................ ................................ ......................... 17 3.9 non - maskable interrupt (nmib) ................................ ................................ ........................... 18 3.10 phase 2 in (phi2) ................................ ................................ ................................ ................... 18 3.11 read/write (rwb) ................................ ................................ ................................ ................. 18 3.12 ready (rdy) ................................ ................................ ................................ .......................... 18 3.13 reset (resb) ................................ ................................ ................................ .......................... 19 3.14 valid data address (vda) and valid program address (vpa) ................................ ............. 19 3.15 vdd and vss ................................ ................................ ................................ ......................... 19 3.16 vector pull (vpb) ................................ ................................ ................................ ................... 19 4 addressing modes ................................ ................................ ................................ ............... 20 4.1 reset and interrup t vectors ................................ ................................ ................................ ... 20 4.2 stack ................................ ................................ ................................ ................................ ...... 20 4.3 direct ................................ ................................ ................................ ................................ ..... 20 4.4 program address space ................................ ................................ ................................ ......... 20 4.5 data address space ................................ ................................ ................................ ................ 20 absolute - a ................................ ................................ ................................ ................................ ................................ ......................... 21 absolute indexed indirect - (a,x) ................................ ................................ ................................ ................................ ..................... 21 absolute indexed with x - a,x ................................ ................................ ................................ ................................ ......................... 21 absolute indexed with y - a,y ................................ ................................ ................................ ................................ ......................... 21 absolute indirect - (a) ................................ ................................ ................................ ................................ ................................ ........ 22 absolute long indexed with x - al,x ................................ ................................ ................................ ................................ ............. 22 absolute long - al ................................ ................................ ................................ ................................ ................................ .............. 22 accumulator - a ................................ ................................ ................................ ................................ ................................ ................. 22
the western design center, inc. W65C816S data sheet the western design center W65C816S 4 block move - xyc ................................ ................................ ................................ ................................ ................................ ............... 22 direct indexed indirect - (d,x) ................................ ................................ ................................ ................................ .......................... 23 direct indexed with x - d,x ................................ ................................ ................................ ................................ .............................. 23 direct indexed with y - d,y ................................ ................................ ................................ ................................ .............................. 23 direct indirect indexed - (d),y ................................ ................................ ................................ ................................ .......................... 24 direct indirect long indexed - [d],y ................................ ................................ ................................ ................................ ............... 24 direct indirect long - [d] ................................ ................................ ................................ ................................ ................................ .. 24 direct indirect - (d) ................................ ................................ ................................ ................................ ................................ ............ 25 direct - d ................................ ................................ ................................ ................................ ................................ .............................. 25 immediate - # ................................ ................................ ................................ ................................ ................................ ...................... 25 implied - i ................................ ................................ ................................ ................................ ................................ ............................ 25 program counter relative long - rl ................................ ................................ ................................ ................................ ................ 25 program counter relative - r ................................ ................................ ................................ ................................ ........................... 26 stack - s ................................ ................................ ................................ ................................ ................................ ................................ 26 stack relative - d,s ................................ ................................ ................................ ................................ ................................ ............. 26 stack relative indirect indexed - (d,s),y ................................ ................................ ................................ ................................ ........ 26 5 timing, ac and dc characteristics ................................ ................................ ............ 28 5.1 absolute maximum ratings ................................ ................................ ................................ ... 28 5.2 dc characteristics ta = - 40 c to +85 c ................................ ................................ .............. 29 6 operation tables ................................ ................................ ................................ ................. 32 7 recommended W65C816S assembler syntax standards ................................ ... 52 7.1 directives ................................ ................................ ................................ ............................... 52 7.2 comments ................................ ................................ ................................ .............................. 52 7.3 the source line ................................ ................................ ................................ ..................... 52 7.3.1 th e label field ................................ ................................ ................................ ................................ ................................ . 52 7.3.2 the operation code field ................................ ................................ ................................ ................................ .............. 52 7.3.3 the operand field ................................ ................................ ................................ ................................ ........................... 53 7.3.4 comment field ................................ ................................ ................................ ................................ ................................ . 55 8 caveats ................................ ................................ ................................ ................................ ........... 56 8.1 stack addressing ................................ ................................ ................................ .................... 57 8.2 direct addressing ................................ ................................ ................................ ................... 57 8.3 absolute indexed addressing ................................ ................................ ................................ . 57 8.4 abortb input ................................ ................................ ................................ ...................... 57 8.5 vda and vpa valid memory addr ess output signals ................................ .......................... 57 8.6 db/ba operation when rdy is pulled low ................................ ................................ ............ 58 8.7 mx output ................................ ................................ ................................ ............................. 58 8.8 all opcodes function in all modes of operation ................................ ................................ .. 58 8 .9 indirect jumps ................................ ................................ ................................ ....................... 58 8.10 switching modes ................................ ................................ ................................ .................... 58 8.11 how interrupts affect the program bank and the data bank registers ................................ 58 8.12 binary mode ................................ ................................ ................................ .......................... 59 8.13 wai instruction ................................ ................................ ................................ ..................... 59 8.14 the stp instruction ................................ ................................ ................................ ............... 59 8.15 cop signatures ................................ ................................ ................................ ...................... 59 8.16 wdm opcode use ................................ ................................ ................................ ................. 59 8.17 rdy pulled during write ................................ ................................ ................................ ...... 59 8.18 mvn and mvp affects on the data bank regist er ................................ ................................ 59 8.19 interrupt priorities ................................ ................................ ................................ ................. 60 8.20 transfers from 8 - bit to 16 - bit, or 16 - bit to 8 - bit registers ................................ .................... 60
the western design center, inc. W65C816S data sheet the western design center W65C816S 5 8.21 stack transfers ................................ ................................ ................................ ...................... 60 8.22 brk instruction ................................ ................................ ................................ ..................... 60 8.23 accumulator switching from 8 bit to 16 bit ................................ ................................ ............ 60 9 hard core model ................................ ................................ ................................ ................. 61 9.1 w65c816 core i nformation ................................ ................................ ................................ ... 61 10 soft core rtl model ................................ ................................ ................................ ...... 61 10.1 w65c816 synthesizable rtl - code in verilog hdl ................................ .............................. 61 11 ordering information ................................ ................................ ................................ . 62
the western design center, inc. W65C816S data sheet the western design center W65C816S 6 table of tables table 2 - 1 W65C816S microprocessor programming model ................................ ................................ ...... 12 table 3 - 1 pin function table ................................ ................................ ................................ ......................... 16 table 4 - 1 addressing mode summary ................................ ................................ ................................ .......... 27 table 5 - 1 absolute maximum ratings ................................ ................................ ................................ .......... 28 table 5 - 2 dc characteristics ................................ ................................ ................................ ......................... 29 table 5 - 3 idd vs. vdd ................................ ................................ ................................ ................................ ... 29 table 5 - 4 f max vs. vdd ................................ ................................ ................................ ............................... 29 table 5 - 4 W65C816S ac ch aracteristics ................................ ................................ ................................ ..... 30 table 6 - 1 W65C816S instruction set - alphabetical sequence ................................ ................................ .... 32 table 6 - 2 emulation mode vector locations (8 - bit mode ) ................................ ................................ ......... 34 table 6 - 3 native mode vector locations (16 - bit mode) ................................ ................................ ............. 34 table 6 - 4 opcode matrix ................................ ................................ ................................ ............................... 35 table 6 - 5 operation, operation codes, and status register (continued on following 4 pages) ............... 36 table 6 - 6 addressing mode symbol table ................................ ................................ ................................ ... 41 table 6 - 7 instruction operation (continued on following 6 pages) ................................ ............................ 42 table 6 - 8 abbreviations ................................ ................................ ................................ ................................ .. 50 table 7 - 1 alternate mnemonics ................................ ................................ ................................ ..................... 53 table 7 - 2 address mode formats ................................ ................................ ................................ .................. 54 table 7 - 3 byte selection operator ................................ ................................ ................................ ................. 55 table 8 - 1 caveats ................................ ................................ ................................ ................................ ............ 56 table of figures figure 2 - 1 W65C816S internal arch itecture simplified block diagram ................................ .................. 11 figure 3 - 1 W65C816S 44 pin plcc pinout ................................ ................................ ................................ . 13 figure 3 - 2 W65C816S 40 pin pdip pinout ................................ ................................ ................................ ... 14 figure 3 - 3 W65C816S 44 pin qfp pinout ................................ ................................ ................................ ... 15 figure 5 - 1 general timing diagram ................................ ................................ ................................ ............. 31 figure 6 - 1 bank address latching circuit ................................ ................................ ................................ .... 51
the western design center, inc. W65C816S data sheet the western design center W65C816S 7 1 introduction the W65C816S is a low power c ost sensitive 16 - bit microprocessor. the variable length instruction set and manually optimized core size makes the W65C816S an excellent choice for low power system - on - chip (soc) designs. the verilog rtl model is available for asic design flows. wdc, a fabless semiconductor company, provides packaged chips for evaluation or volume production. to aid in system development, wdc provides a development system that includes a w65c816db developer board, an in - circuit emulator (ice) and the w65csds software d evelopment system, see www.westerndesigncenter.com for more information. the wdc W65C816S is a fully static cmos 16 - bit microprocessor featuring software compatibility* with the 8 - bit nmos and cmos 6500 - series predecessors. the W65C816S extends address ing to a full 16 megabytes. these devices offer the many advantages of cmos technology, including increased noise immunity, higher reliability, and greatly reduced power requirements. a software switch determines whether the processor is in the 8 - bit "em ulation" mode, or in the native mode, thus allowing existing systems to use the expanded features. as shown in the W65C816S processor programming model, figure 2 - 2, the accumulator, alu, x and y index registers, and stack pointer register have all been ex tended to 16 bits. a new 16 - bit direct page register augments the direct page addressing mode (formerly zero page addressing). separate program bank and data bank registers provide 24 - bit memory addressing with segmented or linear addressing. four new s ignals provide the system designer with many options. the abortb input can interrupt the currently executing instruction without modifying internal register, thus allowing virtual memory system design. valid data address (vda) and valid program address ( vpa) outputs facilitate dual cache memory by indicating whether a data segment or program segment is accessed. modifying a vector is made easy by monitoring the vector pull (vpb) output. key features of the W65C816S advanced fully static cmos design for low power consumption and increased noise immunity wide operating voltage range, 1.8+/ - 5%, 2.5+/ - 5%, 3.0+/ - 5%, 3.3+/ - 10%, 5.0+/ - 5% specified for use with advanced low voltage peripherals emulation mode allows complete hardware and software compatibi lity with 6502 designs 24 - bit address bus provides access to 16 mbytes of memory space full 16 - bit alu, accumulator, stack pointer and index registers valid data address (vda) and valid program address (vpa) output for dual cache and cycle steal dma imple mentation vector pull (vpb) output indicates when interrupt vectors are being addressed abort (abortb) input and associated vector supports processor repairs of bus error conditions low power consumption (300ua@1mhz) separate program and data bank register s allow program segmentation or full 16 mbyte linear addressing new direct register and stack relative addressing provides capability for re - entrant, re - cursive and re - locatable programming 24 addressing modes - 13 original 6502 modes with 92 instructions using 256 opcodes wait - for - interrupt (wai) and stop - the - clock (stp) instructions further reduce power consumption, decrease interrupt latency and allows synchronization with external events co - processor (cop) instruction with associated vector supports c o - processor configurations, i.e., floating point processors block move ability * except for the bbrx, bbsx, rmbx, and smbx bit manipulation instructions which do not exist for the W65C816S
the western design center, inc. W65C816S data sheet the western design center W65C816S 8 2 W65C816S functional description the W65C816S provides the design engineer with upward software compatibility from 8 - bit w65c02 in applications to 16 - bit system application. in emulation mode, the W65C816S offers many advantages, including full software compatibility with 6502 coding. internal organization of the w65c8 16s can be divided into two parts: 1) the register section and 2) the control section. instructions obtained from program memory are executed by implementing a series of data transfers within the register section. signals that cause data transfers to be executed are generated within the control section. the W65C816S has a 16 - bit internal bus architecture with an 8 - bit external data bus and 24 - bit external address bus. 2.1 instruction register (ir) an operation code enters the processor on the data bus, an d is latched into the instruction register during the opcode fetch cycle. this opcode is then decoded, along with timing and interrupt signals, to generate various instruction register control signals for use during instruction operations. 2.2 timing control unit (tcu) the timing control unit keeps track of each instruction cycle as it is executed. the tcu is set to zero each time an instruction fetch is executed, and is advanced at the beginning of each cycle for as many cycles as is required to complete t he instruction. each data transfer between registers depends upon decoding the contents of both the instruction register and the timing control unit. 2.3 arithmetic and logic unit (alu) all arithmetic and logic operations take place within the 16 - bit alu. in addition to data operations, the alu also calculates the effective address for relative and indexed addressing modes. the result of a data operation is stored in either memory or an internal register. carry, negative, overflow and zero flags may be up dated following the alu data operation. 2.4 internal registers (refer to programming model table 2 - 2) 2.5 accumulator (a) the accumulator (a) is a general purpose register which contains one of the operands and the result of most arithmetic and logical operatio ns. in the native mode (e=0), when the accumulator select bit (m) equals zero, the accumulator is established as 16 bits wide (a, b=c). when the accumulator select bit (m) equals one, the accumulator is 8 bits wide (a). in this case, the upper 8 bits (b ) may be used for temporary storage in conjunction with the exchange accumulator (xba) instruction.
the western design center, inc. W65C816S data sheet the western design center W65C816S 9 2.6 data bank register (dbr) during modes of operation, the 8 - bit data bank register (dbr) holds the bank address for memory transfers. the 24 - bit address i s composed of the 16 - bit instruction effective address and the 8 - bit data bank address. the register value is multiplexed with the data value and is present on the data/address lines during the first half of a data transfer memory cycle for the W65C816S. the data bank register is initialized to zero during reset. 2.7 direct (d) the 16 - bit direct register (d) provides an address offset for all instructions using direct addressing. the effective direct address is formed by adding the 8 - bit instruction direct address field to the direct register. the direct register is initialized to zero during reset. the bank address for direct addressing is always zero 2.8 index (x and y) there are two general purpose registers that are commonly referred to as index registe rs (x and y) and are frequently used as an index value for calculation of the effective address. when executing an instruction with indexed addressing, the microprocessor fetches the opcode and the base address, and then modifies the address by adding an index register contents to the address prior to performing the desired operation. pre - indexing or post - indexing of indirect addresses may be selected. in the native mode (e=0), both index registers are 16 bits wide where the index select bit (x) of the p rocessor status (p) register equals zero. if the index select bit (x) equals one, both registers will be 8 bits wide, and the high byte is forced to zero. 2.9 processor status register (p) the 8 - bit processor status register (p) contains status flags and mo de select bits. the carry (c), negative (n), overflow (v), and zero (z) status flags serve to report the status of most alu operations. these status flags are tested by use of conditional branch instructions. the decimal (d), irq disable (i), memory/acc umulator (m), and index (x) bits are used as mode select flags. these flags are set by the program to change microprocessor operations. the emulation (e) select and the break (b) flags are accessible only through the processor status register. the emula tion mode select flag is selected by the exchange carry and emulation bits (xce) instruction. table 8 - 1, W65C816S compatibility information, illustrates the features of the native (e=0) and emulation (e=1) modes. the m and x flags are always equal to one in emulation mode. when an interrupt occurs during emulation mode, the break flag is written to stack memory as bit 4 of the processor status register. 2.10 program bank register (pbr) the 8 - bit program bank register (pbr) holds the bank address for all ins truction fetches. the 24 - bit address consists of the 16 - bit instruction effective address and the 8 - bit program bank address. the register value is multiplexed with the data bus and presented on the data bus lines during the first half of a program memor y cycle. the program bank register is initialized to zero during reset. the phk instruction pushes the pbr register onto the stack.
the western design center, inc. W65C816S data sheet the western design center W65C816S 10 2.11 program counter (pc) the 16 - bit program counter (pc) register provides the addresses which are used to step the microp rocessor through sequential 8 - bit program instruction fields. the pc is incremented for each 8 - bit instruction field that is fetched from program memory. 2.12 stack pointer (s) the stack pointer (s) is a 16 - bit register which is used to indicate the next av ailable location in the stack memory area. it serves as the effective address in stack addressing modes as well as subroutine and interrupt processing. the stack pointer provides simple implementation of nested subroutines and multiple - level interrupts. during emulation mode, the s high - order byte (sh) is always equal to one. the bank address for all stack operations is bank zero.
the western design center, inc. W65C816S data sheet the western design center W65C816S 11 index x (16 bits) index y (16 bits) stack pointer (s) (16 bits) address buffer (low) alu (16 bits) transfer switches accumulator (c) (16 bits) (a) (8 bits) (b) (8 bits) address buffer (high) data bus/bank address buffer prog. counter (pc) (16 bits) direct (d) (16 bits) prog. bank (pbr) (8 bits) data bank (dbr) (8 bits) data latch/ predecode predecode internal data bus (16 bits) inter nal special bus (16 bits) internal address bus (16 bits) timing cont. interupt logic clock gen - erator instruction register (8 bits) processor status (p) (8 bits) system cont. rwb vpa vda mlb vpb e mx register transfer logic instruc tion decode sum of minterms instruction decode minterms phi2 rdy resb nmib irqb abortb vss vdd ao - a7 a8 - a15 do - d7 (816) be figure 2 - 1 W65C816S internal architecture simplified block diagram
the western design center, inc. W65C816S data sheet the western design center W65C816S 12 table 2 - 1 W65C816S microprocessor pr ogramming model 8 bits 8 bits 8 bits data bank register (dbr) x register (xh) x register (xl) data bank register (dbr) y register (yh) y register (yl) 00 stack register (sh) stack register (sl) accumulator (b) accumulator (a) program bank registe r (pbr) program (pch) counter (pcl) 00 direct register (dh) direct register (dl) shaded blocks = 6502 registers 1 b brk command: 1=brk 0=irq e n v m x d i z c carry 1=true zero 1=result zero irq disable 1=disable decimal mode 1=true index register select 1=8 - bit, 0=16 - bit memory select 1=8 - bit, 0=16 - bit overflow 1=true emulation 1=6502 emulation mode negative 1=negative 0=native mode (c)
the western design center, inc. W65C816S data sheet the western design center W65C816S 13 3 pin function description figure 3 - 1 W65C816S 44 pin plcc pinout nmib vpa vdd a0 a1 nc a2 a3 a4 a5 a6 7 8 9 10 11 12 13 14 15 16 17 nc rwb vdd d0 d1 d2 d3 d4 d5 d6 d7 39 38 37 36 35 34 33 32 31 30 29 mlb irqb abortb rdy vpb vss resb vda mx phi2 be 6 5 4 3 2 1 44 43 42 41 40 w65c 816s a7 a8 a9 a10 a11 vss vss a12 a13 a14 a15 18 19 20 21 22 23 24 25 26 27 28
the western design center, inc. W65C816S data sheet the western design center W65C816S 14 figure 3 - 2 W65C816S 40 pin pdip pinout vpb rdy abort irqb mlb nmib vpa vdd a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 resb vda mx phi2 be e rwb d0 d1 d2 d3 d4 d5 d6 d7 a15 a14 a13 a12 vss W65C816S
the western design center, inc. W65C816S data sheet the western design center W65C816S 15 fig ure 3 - 3 W65C816S 44 pin qfp pinout nmib vpa vdd a0 a1 nc a2 a3 a4 a5 a6 1 2 3 4 5 6 7 8 9 10 11 mlb irqb abortb rdy vpb vss resb vda mx phi2 be 44 43 42 41 40 39 38 37 36 35 34 e rwb vdd d 0 d1 d2 d3 d4 d5 d6 d7 33 32 31 30 29 28 27 26 25 24 23 12 13 14 15 16 17 18 19 20 21 22 a7 a8 a9 a10 a11 vss vss a12 a13 a14 a15 w65c8 16s
the western design center, inc. W65C816S data sheet the western design center W65C816S 16 table 3 - 1 pin function table pin description a0 - a15 address bus abortb abort input be bus enable phi2 phas e 2 in clock d0 - d7 data bus/bank address bus e emulation or native mode select irqb interrupt request mlb memory lock mx memory and index register mode select nc no connect nmib non - maskable interrupt rdy ready resb reset rwb read/ write vda valid data address vpb vector pull vpa valid program address vdd positive power supply vss internal logic ground 3.1 abort (abortb) the abort (abortb) negative pulse active input is used to abort instructions (usually due to an address bus c ondition). a negative transition will inhibit modification of any internal register during the current instruction. upon completion of this instruction, an interrupt sequence is initiated. the location of the aborted opcode is stored as the return addre ss in stack memory. the abort vector address is 00fff8,9 (emulation mode) or 00ffe8,9 (native mode). note that abortb is a pulse - sensitive signal; i.e., an abort will occur whenever there is a negative pulse (or level) on the abortb pin during a phi2 clo ck. 3.2 address bus (a0 - a15) the sixteen address bus (a0 - a15) output lines along with the bank address (multiplexed on the first half cycle of the data bus (d0 - d7) pins) form the 24 - bit address bus for memory and i/o exchange on the data bus. when using the W65C816S, the address lines may be set to the high impedance state by the bus enable (be) signal. 3.3 bus enable (be) the bus enable (be) input signal allows external control of the address and data buffers, as well as the rwb signal. with bus enable high, the rwb and address buffers are active. the data/address buffers are active during the first half of every cycle and the second half of a write cycle. when be is low, these buffers are disabled. bus enable is an asynchronous signal. 3.4 data/bank address bus (d0 - d7)
the western design center, inc. W65C816S data sheet the western design center W65C816S 17 the data/bank address bus (d0 - d7) pins provide both the bank address and data. the bank address is present during the first half of a memory cycle, and the data value is read or written during the second half of the memory cycle. two memory cycles are required to transfer 16 - bit values. these lines may be set to the high impedance state by the bus enable (be) signal. 3.5 emulation status (e) the emulation status (e) output reflects the state of the emulation (e) mode flag in the processor stat us (p) register. this signal may be thought of as an opcode extension and used for memory and system management. 3.6 interrupt request (irqb) the interrupt request (irqb) negative level active input signal is used to request that an interrupt sequence be in itiated. when the irqb disable (i) flag is cleared, a low input logic level initiates an interrupt sequence after the current instruction is completed. the wait - for - interrupt (wai) instruction may be executed to ensure the interrupt will be recognized im mediately. the interrupt request vector address is 00fffe,f (emulation mode) or 00ffee,f (native mode). since irqb is a level - sensitive input, an interrupt will occur if the interrupt source was not cleared since the last interrupt. also, no interrupt wi ll occur if the interrupt source is cleared prior to interrupt recognition. the irqb signal going low causes 4 bytes of information to be pushed onto the stack before jumping to the interrupt handler. the first byte is pbr followed by pch, pcl and p (pro cessor status register). these register values are used by the rti instruction to return the processor to its original state prior to handling the irq interrupt (see table 6 - 1) 3.7 memory lock (mlb) the memory lock (mlb) active low output may be used to ens ure the integrity of read - modify - write instructions in a multiprocessor system. memory lock indicates the need to defer arbitration of the next bus cycle. memory lock is low during the last three or five cycles of asl, dec, inc, lsr, rol, ror, trb, and t sb memory referencing instructions, depending on the state of the m flag. 3.8 memory/index select status (mx) the memory/index select status (mx) multiplexed output reflects the state of the accumulator (m) and index (x) elect flags (bits 5 and 4 of the proc essor status (p) register. flag m is valid during phi2 negative transition and flag x is valid during phi2 positive transition. these bits may be thought of as opcode extensions and may be used for memory and system management.
the western design center, inc. W65C816S data sheet the western design center W65C816S 18 3.9 non - maskable interrupt ( nmib) a negative transition on the non - maskable interrupt (nmib) input initiates an interrupt sequence. a high - to - low transition initiates an interrupt sequence after the current instruction is completed. the wait for interrupt (wai) instruction may be executed to ensure that the interrupt will be recognized immediately. the non - maskable interrupt vector address is 00fffa,b (emulation mode) or 00ffea,b (native mode). since nmib is an edge - sensitive input, an interrupt will occur if there is a negative transition while servicing a previous interrupt. no interrupt will occur if nmib remains low after the negative transition was processed. the nmib signal going low causes 4 bytes of information to be pushed onto the stack before jumping to the interrupt handler. the first byte on the stack is the pbr followed by the pch, pcl and p, these register values are used by the rti instruction to return the processor to its original state prior to the nmi interrupt. 3.10 phase 2 in (phi2) phase 2 in (phi2) is the sy stem clock input to the microprocessor. phi2 can be held in either state to preserve the contents of internal registers and reduce power as a standby mode. 3.11 read/write (rwb) the read/write (rwb) output signal is used to control whether the microprocessor is "reading" or "writing" to memory. when the rwb is in the high state, the microprocessor is reading data from memory or i/o. when rbw is low the data bus contains valid data from the microprocessor which is to written to the addressed memory location. the rwb signal is set to the high impedance state when bus enable (be) is low. 3.12 ready (rdy) the ready (rdy) is a bi - directional signal. when it is an output it indicates that a wait for interrupt (wai) instruction has been executed halting operation of the microprocessor. a low input logic level will halt the microprocessor in its current state. returning rdy to the active high state releases the microprocessor to continue processing following the next phi2 negative transition. the rdy signal is inter nally pulled low following the execution of a wait for interrupt (wai) instruction, and then returned to the high state when a resb, abortb, nmib, or irqb external interrupt is active. this feature may be used to reduce interrupt latency by executing the wai instruction and waiting for an interrupt to begin processing. if the irqb disable flag has been set, the next instruction will be executed when the irqb occurs. the processor will not stop after a wai instruction if rdy has been forced to a high stat e. the stop (stp) instruction has no effect on rdy. the rdy pin has an active pull - up and when outputting a low level, the pull - up is turned off to reduce power. the rdy pin can be wired ored.
the western design center, inc. W65C816S data sheet the western design center W65C816S 19 3.13 reset (resb) the reset (resb) active low input is used to initialize the microprocessor and start program execution. the reset input buffer has hysteresis such that a simple r - c timing circuit may be used with the internal pull - up device. the resb signal must be held low for at least two clock cycles after vdd r eaches operating voltage. ready (rdy) has no effect while resb is being held low. the stack pointer must be initialized by the user's software. during the reset conditioning period the following processor initialization takes place: registers d=0000 s h=01, sl=* dbr=00 xh=00, xl=* pbr=00 yh=00, yl=* a=* p register n v m x d i z c/e * * 1 1 0 1 * */1 *=not initialized when reset is brought high , an interrupt sequence is initiated stp and wai instructions are cleared rwb remains in the high state during the stack address cycles. the reset vector address is 00fffc,d.(see table 6 - 1 for vectors) pc is loaded with the contents of 00fffc,d 3.14 vali d data address (vda) and valid program address (vpa) the valid data address (vda) and valid program address (vda) output signals indicate valid memory addresses when high and are used for memory or i/o address qualification. vda vpa 0 0 internal oper ation address and data bus available. the address bus may be invalid. 0 1 valid program address - may be used for program cache control. 1 0 valid data address - may be used for data cache control. 1 1 opcode fetch - may be used for program cache con trol and single step control 3.15 vdd and vss vdd is the positive supply voltage and vss is system logic ground. 3.16 vector pull (vpb) the vector pull (vpb) active low output indicates that a vector location is being addressed during an interrupt sequence. vpb is low during the last two interrupt sequence cycles, during which time the processor loads the pc with the interrupt handler vector location. the vpb signal may be used to select and prioritize interrupts from several sources by modifying the vector add resses. signals e=1 vda=0 mx=1 vpb=1 rwb=1 vpa=0
the western design center, inc. W65C816S data sheet the western design center W65C816S 20 4 addressing modes the W65C816S is capable of directly addressing 16 mbytes of memory. this address space has special significance within certain addressing modes, as follows: 4.1 reset and interrupt vectors the reset and interrupt vectors use the m ajority of the fixed addresses between 00ffe0 and 00ffff. 4.2 stack the stack may be use memory from 000000 to 00ffff. the effective address of stack and stack relative addressing modes will be always be within this range. 4.3 direct the direct addressing mo des are usually used to store memory registers and pointers. the effective address generated by direct, direct,x and direct,y addressing modes is always in bank 0 (000000 - 00ffff). 4.4 program address space the program bank register is not affected by the re lative, relative long, absolute, absolute indirect, and absolute indexed indirect addressing modes or by incrementing the program counter from ffff. the only instructions that affect the program bank register are: rti, rtl, jml, jsl, and jmp absolute long . program code may exceed 64k bytes although code segments may not span bank boundaries. 4.5 data address space the data address space is contiguous throughout the 16 mbyte address space. words, arrays, records, or any data structures may span 64 kbyte ban k boundaries with no compromise in code efficiency. the following addressing modes generate 24 - bit effective addresses: absolute a absolute a,x absolute a,y absolute long al absolute long indexed al,x direct indexed indirect (d,x) direct indirect (d) direct indirect indexed (d),y direct indirect long [d] direct indirect long indexed [d],y stack relative indirect indexed (d,x),y the following addressing mode descriptions provide additional detail as to how effective addresses are calculated. t wenty - four addressing modes are available for the W65C816S.
the western design center, inc. W65C816S data sheet the western design center W65C816S 21 absolute - a with absolute (a) addressing the second and third bytes of the instruction form the low - order 16 bits of the effective address. the data bank register contains the high - order 8 bits of the operand address. instruction: opcode addrl addrh operand dbr addrh addrl absolute indexed indirect - (a,x) with absolute indexed indirect ((a,x)) addressing the second and third bytes of the instruction are added to the x index register to form a 16 - bit pointer in bank 0. the contents of this pointer are loaded in the program counter for the jmp instruction. the program bank register is not changed. instruction: opcode addrl addrh addrh addrl x reg pbr address then: pc = (address) abs olute indexed with x - a,x with absolute indexed with x (a,x) addressing the second and third bytes of the instruction are added to the x index register to form the low - order 16 - bits of the effective address. the data bank register contains the high - order 8 bits of the effective address. instruction: opcode addrl addrh dbr addrh addrl + x reg operand address: effective address absolute indexed with y - a,y with absolute indexed with y (a,y) addressing the second and third bytes of the instruction a re added to the y index register to form the low - order 16 - bits of the effective address. the data bank register contains the high - order 8 bits of the effective address. instruction: opcode addrl addrh dbr addrh addrl + y reg operand address: effect ive address
the western design center, inc. W65C816S data sheet the western design center W65C816S 22 absolute indirect - (a) with absolute indirect ((a)) addressing the second and third bytes of the instruction form an address to a pointer in bank 0. the program counter is loaded with the first and second bytes at this pointer. with the j ump long (jml) instruction, the program bank register is loaded with the third byte of the pointer. instruction: opcode addrl addrh indirect 00 addrh addrl absolute long indexed with x - al,x with absolute long indexed with x (al,x) addressing the se cond, third and fourth bytes of the instruction form a 24 - bit base address. the effective address is the sum of this 24 - bit address and the x index register. instruction: opcode addrl addrh baddr baddr addrh addrl + x reg operand address: effecti ve address absolute long - al with absolute long (al) addressing the second, third and fourth byte of the instruction form the 24 - bit effective address. instruction: opcode addrl addrh baddr operand address: baddr addrh addrl accumulator - a with ac cumulator (a) addressing the operand is the accumulator. block move - xyc block move (xyc) addressing is used by the block move instructions. the second byte of the instruction contains the high - order 8 bits of the destination address and the y index regis ter contains the low - order 16 bits of the destination address. the third byte of the instruction contains the high - order 8 bits of the source address and the x index register contains the low - order bits of the source address. the c accumulator contains o ne less than the number of bytes to move. the second byte of the block move instructions is also loaded into the data bank register. instruction: opcode dstbnk srcbnk dstbnk y dbr source address: srcbnk x reg dest. address; dbr y reg increment x and y (mvn) or decrement x and y (mvp) and decrement c (if greater than zero), then pc=pc+3.
the western design center, inc. W65C816S data sheet the western design center W65C816S 23 direct indexed indirect - (d,x) direct indexed indirect ((d,x)) addressing is often referred to as indirect x addressing. the second byte of t he instruction is added to the sum of the direct register and the x index register. the result points to the x low - order 16 bits of the effective address. the data bank register contains the high - order 8 bits of the effective address. instruction: opcod e offset direct register + offset direct address + x reg 00 (address) then: + dbr operand address: effective address direct indexed with x - d,x with direct indexed with x (d,x) addressing the second byte of the instruction is added to the sum of the direct register and the x index register to form the 16 - bit effective address. the operand is always in bank 0. instruction: opcode offset direct register + offset direct address + x reg operand address: 00 effect ive address direct indexed with y - d,y with direct indexed with y (d,y) addressing the second byte of the instruction is added to the sum of the direct register and the y index register to form the 16 - bit effective address. the operand is always in bank 0. instruction: opcode offset direct register + offset direct address + y reg operand address: 00 effective address
the western design center, inc. W65C816S data sheet the western design center W65C816S 24 direct indirect indexed - (d),y direct indirect indexed ((d),y) addressing is often referred to as indirect y addressing. the second byte of the instruction is added to the direct register (d). the 16 - bit content of this memory location is then combined with the data bank register to form a 24 - bit base address. the y index register is added to the base address to form the effective address. instruction: opcode offset direct register + offset 00 (direct address) then: + dbr base address + y reg operand address: effective address direct indirect long indexed - [d],y with direct indirect long indexed ([d],y) addressing the 24 - bit base address is pointed to by the sum of the second byte of the instruction and the direct register. the effective address is this 24 - bit base address plus the y index register. instruction: opcode off set direct register + offset 00 direct address base address then + y reg operand address: effective address direct indirect long - [d] with direct indirect long ([d]) addressing the second byte o f the instruction is added to the direct register to form a pointer to the 24 - bit effective address. instruction: opcode offset direct register then: + offset 00 (direct address) operand address: direct address
the western design center, inc. W65C816S data sheet the western design center W65C816S 25 direct indirect - (d) with direc t indirect ((d)) addressing the second byte of the instruction is added to the direct register to form a pointer to the low - order 16 bits of the effective address. the data bank register contains the high - order 8 bits of the effective address. instructio n: opcode offset direct register + offset 00 (direct address) then: + dbr operand address: effective address direct - d with direct (d) addressing the second byte of the instruction is added to the direct register (d) to form the effective address. an additional cycle is required when the direct register is not page aligned (dl not equal 0). the bank register is always 0. instruction: opcode offset direct register + offset operand address: 00 effective address immediat e - # with immediate (#) addressing the operand is the second byte (second and third bytes when in the 16 - bit mode) of the instruction. implied - i implied (i) addressing uses a single byte instruction. the operand is implicitly defined by the instruction. program counter relative long - rl the program counter relative long (rl) addressing mode is used with only with the unconditional branch long instruction (brl) and the push effective relative instruction (per). the second and third bytes of the instruct ion are added to the program counter, which has been updated to point to the opcode of the next instruction. with the branch instruction, the program counter is loaded with the result. with the push effective relative instruction, the result is stored on the stack. the offset is a signed 16 - bit quantity in the range from - 32768 to 32767. the program bank register is not affected .
the western design center, inc. W65C816S data sheet the western design center W65C816S 26 program counter relative - r the program counter relative (r) addressing is referred to as relative addressing and is used o nly with the branch instructions. if the condition being tested is met, the second byte of the instruction is added to the program counter, which has been updated to point to the opcode of the next instruction. the offset is a signed 8 - bit quantity in th e range from - 128 to 127. the program bank register is not affected. stack - s stack (s) addressing refers to all instructions that push or pull data from the stack, such as push, pull, jump to subroutine, return from subroutine, interrupts, and return fr om interrupt. the bank address is always 0. interrupt vectors are always fetched from bank 0. stack relative - d,s with stack relative (d,s) addressing the low - order 16 bits of the effective address is formed from the sum of the second byte of the instru ction and the stack pointer. the high - order 8 bits of the effective address are always zero. the relative offset is an unsigned 8 - bit quantity in the range of 0 to 255. instruction: opcode offset stack pointer then: + offset operand address: 00 e ffective address stack relative indirect indexed - (d,s),y with stack relative indirect indexed ((d,s),y) addressing the second byte of the instruction is added to the stack pointer to form a pointer to the low - order 16 - bit base address in bank 0. the d ata bank register contains the high - order 8 bits of the base address. the effective address is the sum of the 24 - bit base address and the y index register. instruction: opcode offset stack pointer offset 00 s + offset then + dbr base address + y reg operand address: effective address
the western design center, inc. W65C816S data sheet the western design center W65C816S 27 table 4 - 1 addressing mode summary address mode instruction times in memory cycle memory utilization in number of program sequence bytes o riginal 8 - bit nmos 6502 new W65C816S original 8 - bit nmos 6502 new W65C816S absolute 4 (5) 4 (3,5) 3 3 absolute indexed indirect (jump) - 6 - 3 absolute indirect (jump) 5 5 3 3 absolute long - 5 (3) - 4 absolute long, x - 5 (3) - 4 absolute, x 4 (1, 5) 4 (1,3,5) 3 3 absolute, y 4 (1) 4 (1,3) 3 3 accumulator 2 2 1 1 block move (xyc) - 7 - 3 direct 3 (5) 3 (3,4,5) 2 2 direct indexed indirect (d,x) 6 6 (3,4) 2 2 direct indirect - 5 (3,4) - 2 direct indirect indexed (d),y 5 (1) 5 (1,3,4) 2 2 direc t indirect indexed long [d],y - 6 (3,4) - 2 direct indirect long - 6 (3,4) - 2 direct, x 4 (5) 4 (3,4,5) 2 2 direct, y 4 4 (3,4) 2 2 immediate 2 2 (3) 2 2 (3) implied 2 2 1 1 relative 2 (1,2) 2 (2) 2 2 relative long - 3 (2) - 3 stack 3 - 7 3 - 8 1 - 3 1 - 4 stack relative - 4 (3) - 2 stack relative indirect indexed - 7 (3) - 2 notes (these are indicated in parentheses): 1. page boundary, add 1 cycle if page boundary is crossed when forming address. 2. branch taken, add 1 cycle if branch is taken. 3. m = 0 or x = 0, 16 bit operation, add 1 cycle, add 1 byte for immediate. 4. direct register low (dl) not equal zero, add 1 cycle. 5. read - modify - write, add 2 cycles for m = 1, add 3 cycles for m = 0.
the western design center, inc. W65C816S data sheet the western design center W65C816S 28 5 timing, ac and dc characteristics 5.1 absolute maximum ratings table 5 - 1 absolute maximum ratings rating symbol value supply voltage vdd - 0.3 to +7.0v input voltage vin - 0.3 to vdd +0.3v storage temperature ts - 55 c to +150 c this device contains input pr otection against damage due to high static voltages or electric fields; however, precautions should be taken to avoid application of voltages higher than the maximum rating. note: exceeding these ratings may result in permanent damage. functional oper ation under the conditions is not implied.
the western design center, inc. W65C816S data sheet the western design center W65C816S 29 5.2 dc characteristics ta = - 40 c to +85 c table 5 - 2 dc characteristics 5.0 +/ - 5% 3.3 +/ - 10% 3.0 +/ - 5% 2.5 +/ - 5% 1.8 +/ - 5% units symbol min max min max min max min max min max vdo 4 .25 5.25 3.0 3.6 2.85 3.15 2.375 2.625 1.71 1.89 v vih input high voltage abortb, be, data, irqb, rdy, nmib, phi2, resb vddx0.8 vdd+0.3 vddx0.8 vdd+0.3 vddx0.8 vdd+0.3 vddx0.8 vdd+0.3 vddx0.8 vdd+0.3 v vil input low voltage abort b, be, data, irqb, rdy, nmib, phi2, resb vss - 0.3 vddx0.2 vss - 0.3 vddx0.2 vss - 0.3 vddx0.2 vss - 0.3 vddx0.2 vss - 0.3 vddx0.2 v ipup rdy input pullup - current (vin=vddx0.8) 5 20 5 20 5 20 2 10 2 10 m a iin input leakage current (vin=0.4 to 2.4) phi2, address, data, rwb, (off state, be=0), all other inputs - 0.2 0.2 - 0.2 0.2 - 0.2 0.2 - 0.2 0.2 - 0.2 0.2 m a ioh output high voltage (vol=vdd - 0.4v) address, data, e, mlb, mx, rwb, vda, vpa, vpb 700 - 300 - 300 - 200 - 100 - m a iol output l ow voltage (vol=vss+0.4v) address, data, e, mlb, mx, rwb, vda, vpa, vpb 1.6 - 1.6 - 1.6 - 1.0 - .5 - ma idd supply current (no load) supply current (core) - - 2.0 1.0 - 1.5 0.6 - 1.5 0.5 - 1.0 0.4 - 0.75 0.30 ma/ mhz isby standby current (no load, dat a bus = vss or vdd) abortb, be, irqb, nmib, resb, phi2=vdd - 1 - 1 - 1 - 1 m a cin cts capacitance (vin=0v, ta=25 c, f=1mhz) abortb, be, irqb, nmib, phi2, rbw, resb, rdy, address, data, r/w - (off state) * not inspected during production test; verif ied on a sample basis. - 5 - 5 - 5 - 5 - 5 pf pf vdd (volts) table 5 - 3 idd vs. vdd table 5 - 4 f max vs. vdd 1.1 1.8 1.0 1.5 2.0 3.0 3.5 4.0 4.5 5.0 5.5 5 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 2.0 1.2 1 mhz operation@85 c 1.6 0 idd (ma) 6.0 2.5 f max (mhz) 0.0 typical 0.6u processed device @85 c 1 2 3 4 6 vdd (volts) 0 2 4 6 8 10 12 14 16 18 20 (with tester loading) (core power only) typical 0.6u processed device
the western design center, inc. W65C816S data sheet the western design center W65C816S 30 table 5 - 2 W65C816S ac characteristics symbol parameter 5.0 +/ - 5% 3.3 +/ - 10% 3.0 +/ - 5% 2.5 +/ - 5% 1.8 +/ - 5% units 14mhz 8mhz 8mhz 4mhz 2mhz min max min max min max min max min max vdd 4.75 5.25 3.0 3.6 2.85 3.15 2.375 2.675 1.71 1.89 v tcyc cycle time 70 dc 125 dc 125 dc 250 dc 500 dc ns tpwl clock pulse width low 35 - 63 - 63 - 125 - 250 - ns tpwh clock pulse width high 35 - 62 - 62 - 125 - 250 - ns tf,tr fall time, rise time - 5 - 5 - 5 - 5 - 5 ns tah a0 - a15 hold time 10 - 10 - 10 - 20 - 40 - ns t ads a0 - a15 setup time - 30 - 40 - 40 - 75 - 150 ns tbh ba0 - ba7 hold time 10 - 10 - 10 - 20 - 40 - ns tbas ba0 - ba7 setup time - 33 - 40 - 40 - 75 - 150 ns tacc access time 30 - 70 - 70 - 130 - 365 - ns tdhr read data hold time 10 - 10 - 10 - 20 - 40 - n s tmds write data delay time - 30 - 40 - 40 - 70 - 140 ns tdhw write data hold time 10 - 10 - 10 - 20 - 40 - ns tpcs processor control setup time 10 - 15 - 15 - 30 - 60 - ns tpch processor control hold time 10 - 10 - 10 - 20 - 40 - ns teh e, mx output hold time - 5 - 5 - 5 - 5 - 5 ns tes e, mx output setup time 10 - 15 - 15 - 30 - 60 - ns cext capacitive load (1) - 35 - 35 - 35 - 35 - 35 pf tbvd be to valid data (2) - 25 - 30 - 30 - 60 - 120 ns 1. test or loading on all outputs. 2. be to hi gh impedance state is not testable but should be the same amount of time as be to valid data.
the western design center, inc. W65C816S data sheet the western design center W65C816S 31 figure 5 - 1 general timing diagram 1. timing measurement points are 50% vdd. tpcs tes teh teh data be abortb write data read data rwb, sync vpb, mlb a0 - a15 tf tr tpwh phi2 tpwl write data tbvd m m x x ieh tpcs tpch tdhw tdhr tdsr tmds tah see note 1 tah tads tdhr tdhw irqb, nmib, re sb, rdy m/x m tes e tacc teh
the western design center, inc. W65C816S data sheet the western design center W65C816S 32 6 operation tables table 6 - 1 W65C816S instruction set - alphabetical sequence (continued on following page) 1. adc add memory to accumulator with carry 30. iny increment index y by one 2. and "and" memory with accumulator 31. jml jump long 3. asl shift one bit left, memory or accumulator 32. jmp jump to new location 4. bcc branch on carry clear (c=0) 33. jsl jump subroutine long 5. bcs branch on carry set (c=1) 34. jsr jump to news location saving return 6. beq branch if equal (z=1) 35. lda load accumulator with memory 7. bit bit test 36. ldx load index x with memory 8. bmi branch if re sult minus (n=1) 37. ldy load index y with memory 9. bne branch if not equal (z=0) 38. lsr shift one bit right (memory or accumulator) 10. bpl branch if result plus (n=0) 39. mvn block move negative 11. bra branch always 40. mvp block move positive 12. brk force break 41. no p no operation 13. brl branch always long 42. ora "or" memory with accumulator 14. bvc branch on overflow clear (v=0) 43. pea push effective absolute address on stack (or push immediate data on stack) 15. bvs branch on overflow set (v=1) 44. pei push effective absolute address on stack ( or push direct data on stack) 16. clc clear carry flag 45. per push effective program counter relative address on stack 17. cld clear decimal mode 46. pha push accumulator on stack 18. cli clear interrupt disable bit 47. phb push data bank register o n stack 19. clv clear overflow flag 48. phd push direct register on stack 20. cmp compare memory and accumulator 49. phk push program bank register on stack 21. cop coprocessor 50. php push processor status on stack 22. cpx compare memory and index x 51. phx push index x o n stack 23. cpy compare memory and index y 52. phy push index y on stack 24. dec decrement memory or accumulator by one 53. pla pull accumulator from stack 25. dex decrement index x by one 54. plb pull data bank register from stack 26. dey decrement index y by one 55. pld p ull direct register from stack 27. eor "exclusive or" memory with accumulator 56. plp pull processor status from stack 28. inc increment memory or accumulator by one 57. plx pull index x from stack 29. inx increment index x by one 58. ply pull index y from stack
the western design center, inc. W65C816S data sheet the western design center W65C816S 33 59. 5 rep reset status bits 76. tay transfer accumulator to index y 60. rol rotate one bit left (memory or accumulator) 77. tcd transfer c accumulator to direct register 61. ror rotate one bit right (memory or accumulator) 78. tcs transfer c accumulator t o stack pointer register 62. rti return from interrupt 79. tdc transfer direct register to c accumulator 63. rtl return from subroutine long 80. trb test and reset bit 64. rts return from subroutine 81. tsb test and set bit 65. sbc subtract memory from accumulator with bor row 82. tsc transfer stack pointer register to c accumulator 66. sep set processor status bit 83. tsx transfer stack pointer register to index x 67. sec set carry flag 84. txa transfer index x to accumulator 68. sed set decimal mode 85. txs transfer index x to stack pointer register 69. sei set interrupt disable status 86. txy transfer index x to index y 70. sta store accumulator in memory 87. tya transfer index y to accumulator 71. stp stop the clock 88. tyx transfer index y to index x 72. stx store index x in memory 89. wai wait for interrupt 73. sty store index y in memory 90. wdm reserved for future use 74. stz store zero in memory 91. xba exchange b and a accumulator 75. tax transfer accumulator in index x 92. xce exchange carry and emulation bits
the western design center, inc. W65C816S data sheet the western design center W65C816S 34 table 6 - 2 emulation mode vector locations (8 - bit mode) address label function 00fffe,f irqb/brk hardware/software 00fffc,d resetb hardware 00fffa,b nmib hardware 00fff8,9 abortb hardware 00fff6,7 (reserved) hardware 00fff4,5 cop software 00 fff2,3 (reserved) 00fff0,1 (reserved) table 6 - 3 native mode vector locations (16 - bit mode) address label function 00fffe,f irqb hardware 00fffc,d (reserved) 00fffa,b nmib hardware 00fff8,9 abortb 00fff6,7 brk software 00fff4,5 cop software 00fff2,3 (reserved) 00fff0,1 (reserved) the vp output is low during the two cycles used for vector location access. when an interrupt is executed, d=0 and i=1 in status register p.
the western design center, inc. W65C816S data sheet the western design center W65C816S 35 table 6 - 4 opcode matrix m s d lsd m s d 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 brk s 7,2 ora(d,x) 6,2 cop s 7,2 * ora d,s 4,2 * tbs d 5,2 ! ora d 3,2 asl d 5,2 * ora [d] 6,2 php s 3,1 ora# 2,2 asl a 2,1 phd s 4,1 * tsb a 6,3 ! ora a 4,3 asl a 6,3 ora al 5,4 * 0 1 bpl r 2,2 ora(d),y 5,2 ora(d) 5,2 ! ora(d,s),y 7,2 * trb d 5,2 ! ora d,x 4,2 asl d,x 6,2 * ora[d],y 6,2 clc i 2,1 ora a,y 4,3 inc a 2,1 ! tcs i 2,1 * trb a 6,3 ! ora a,x 4,3 asl a,x 7,3 ora al,x 5,4 * 1 2 jsr a 6,3 and(d,x) 6,2 jsl al 8,4 * and d,s 4,2 * bit d 3,2 and d 3,2 rol d 5,2 * and [d] 6,2 plp s 4,1 and# 2,2 rol a 2,1 pld s 5,1 * bit a 4,3 and a 4,3 rol a 6,3 and al 5,4 * 2 3 bmi r 2,2 and(d),y 5,2 and(d) 5,2 ! and(d,s),y 7,2 * bit d,x 4,2 ! and d,x 4,2 rol d,x 6,2 * and[d],y 6,2 sec i 2,1 and a,y 4,3 dec a 2,1 ! tsc i 2,1 * bit a,x 4,3 ! and a,x 4,3 rol a,x 7,3 and al,x 5,4 * 3 4 rti s 7,1 eor(d, x) 6,2 wdm 2,2 * eor d,s 4,2 * mvp xyc 7,3 * eor d 3,2 lsr d 5,2 * eor [d] 6,2 pha s 3,1 eor # 2,2 lsr a 2,1 phk s 3,1 * jmp a 3,3 eor a 4,3 lsr a 6,3 eor al 5,4 * 4 5 bvc r 2,2 eor (d),y 5,2 eor (d) 5,2 ! eor(d,s),y 7,2 * mvn x yc 7,3 * eor d,x 4,2 lsr d,x 6,2 * eor[d].y 6,2 cli i 2,1 eor a,y 4,3 phy s 3,1 ! tcd i 2,1 * jmp al 4,4 * eor a,x 4,3 lsr a,x 7,3 eor al,x 5,4 * 5 6 rts s 6,1 adc(d,x) 6,2 per s 6,3 * adc d,s 4,2 * stz d 3,2 ! adc d 3,2 ror d 5,2 * ad c[d] 6,2 pla s 4,1 adc# 2,2 ror a 2,1 rtl s 6,1 * jmp (a) 5,3 adc a 4,3 ror a 6,3 adc al 5,4 * 6 7 bvs r 2,2 adc(d),y 5,2 adc(d) 5,2 ! adc(d,s),y 7,2 * stz d,x 4,2 ! adc d,x 4,2 ror d,x 6,2 * adc[d],y 6,2 sei i 2,1 adc a,y 4,3 ply s 4,1 tdc i 2, 1 * jmp(a,x) 6,3 ! adc a,x 4,3 ror a,x 7,3 adc al,x 5,4 * 7 8 bra r 2,2 ! sta(d,x) 6,2 brl rl 3,3 * sta d,s 4,2 * sty d 3,2 sta d 3,2 stx d 3,2 * sta[d] 6,2 dey i 2,1 bit # 2,2 ! txa i 2,1 phb s 3,1 * sty a 4,3 sta a 4,3 stx a 4,3 sta al 5,4 * 8 9 bcc r 2,2 sta(d),y 6,2 sta (d) 5,2 ! sta(d,s),y 7,2 * sty d,x 4,2 sta d,x 4,2 stx d,y 4,2 * sta[d],y 6,2 tya i 2,1 sta a,y 5,3 txs i 2,1 txy i 2,1 * stz a 3,4 ! sta a,x 5,3 stz a,x 5,3 ! sta al,x 5,4 * 9 a ldy # 2,2 lda (d,x) 6,2 ldx # 2,2 lda d,s 4,2 * ldy d 3,2 lda d 3,2 ldx d 3,2 * lda [d] 6,2 tay i 2,1 lda# 2,2 tax i 2,1 plb s 4,1 * ldy a 4,3 lda a 4,3 ldx a 4,3 lda al 5,4 * a b bcs r 2,2 lda (d),y 5,2 lda (d) 5,2 ! lda(d,s),y 7,2 * ldy d,x 4,2 lda d, x 4,2 ldx d,y 4,2 * lda[d],y 6,2 clv i 2,1 lda a,y 4,3 tsx i 2,1 tyx i 2,1 * ldy a,x 4,3 lda a,x 4,3 ldx a,y 4,3 lda al,x 5,4 * b c cpy # 2,2 cmp (d,x) 6,2 rep # 3,2 * cmp d,s 4,2 * cpy d 3,2 cmp d 3,2 dec d 5,2 * cmp [d] 6,2 iny i 2,1 cmp # 2,2 dex i 2,1 wai i 3,1 ! cpy a 4,3 cmp a 4,3 dec a 6,3 cmp al 5,4 * c d bne r 2,2 cmp (d),y 5,2 cmp (d) 5,2 ! cmp(d,s),y 7,2 * pei s 6,2 * cmp d,x 4,2 dec d,x 6,2 * cmp[d],y 6,2 cld i 2,1 cmp a,y 4,3 phx s 3,1 ! stp i 3,1 ! jml (a ) 6,3 * cmp a,x 4,3 dec a,x 7,3 cmp al,x 5,4 * d e cpx # 2,2 sbc (d,x) 6,2 sep # 3,2 * sbc d,s 4,2 * cpx d 3,2 sbc d 3,2 inc d 5,2 * sbc [d] 6,2 inx i 2,1 sbc # 2,2 nop i 2,1 xba i 3,1 * cpx a 4,3 sbc a 4,3 inc a 6,3 sbc al 5,4 * e f beq r 2,2 sbc (d),y 5,2 sbc (d) 5,2 ! sbc(d,s),y 7,2 * pea s 5,3 * sbc d,x 4,2 inc d,x 6,2 * sbc[d],y 6,2 sed i 2,1 sbc a,y 4,3 plx s 4,1 ! xce i 2,1 * jsr (a,x) 6,3 * sbc a,x 4,3 inc a,x 7,3 sbc al,x 5,4 * f 0 1 2 3 4 5 6 7 8 9 a b c d e f * = old instruction with new addressing modes ! = new instruction
the western design center, inc. W65C816S data sheet the western d esign center W65C816S 36 table 6 - 5 operation, operation codes, and status register (continued on following 4 pages) operation + add - subtract ^ and processor status code v or a a a,x a,y al al, x (a) (a,x) d d,s d,x d,y (d) [d] (d,s),y (d,x) (d),y [d],y i r rl s xyc # 7 6 5 4 3 2 1 0 mnemonic v exclusive or 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 n v 1 b d 1 z c adc a+m+c ? a 6d 7d 79 6f 7f 17 65 63 75 72 67 73 61 71 77 69 n v . . . . z c and a ^ m ? a 2d 3e 39 2f 3f 25 23 36 32 27 33 91 31 37 29 n . . . . . z . asl c ? 15/7 6 5 4 3 2 10 ? 0 0e 0a 1e 06 16 n . . . . . z c bcc branch if c = 0 90 . . . . . . . . bcs branch if c = 1 b0 . . . . . . . . beq branch if z = 1 f0 . . . . . . . . bit a ^ m (note 1) 2c 3c 24 34 89 m 7 m 6 . . . . z . bmi branch if n = 0 30 . . . . . . . . bne branch if z = 0 d0 . . . . . . . . bpl branch if n = 0 10 . . . . . . . . bra branch always 80 . . . . . . . . brk break (note 2) 00 . . . ? 0 1 . . brl* branch long always 82 . . . . . . . . bvc branch if v = 0 50 . . . . . . . . bvs branch if v = 1 70 . . . . . . . . clc c ? 0 18 . . . . . . . 0 cld 0 ? d d8 . . . . 0 . . . cli 0 ? 1 58 . . . . . 0 . . cl v 0 ? v b8 . 0 . . . . . . cmp a - m cd dd d9 cf df c5 c3 d5 d2 c7 d3 c1 d1 d7 c9 n . . . . . z c cop* co - processor 02 . . . . 0 1 . .
the western design center, inc. W65C816S data sheet the western d esign center W65C816S 37 table 6 - 5 (continued) operation + add - subtract ^ and processor status code v or a a a,x a,y al al,x (a) (a,x) d d,s d,x d,y (d) [d] (d,s),y (d,x) (d),y [d],y i r rl s xyc # 7 6 5 4 3 2 1 0 mnemonic v exclus ive or 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 n v 1 b d i z c cpx x - m ec e4 e0 n . . . . . z c cpy y - m cc c4 c0 n . . . . . z c dec decrement ce 3a de c6 d6 n . . . . . z . dex x - 1 ? a ca n . . . . . z . dey y - 1 ? y 88 n . . . . . z . eor a v m ? a 4d 5d 59 4f 5f 5d 45 43 55 52 47 53 41 51 57 49 n . . . . . z . inc increments ee 1a fe e6 f6 n . . . . . z . inx x+1 ? x e8 n . . . . . z . iny y+1 ? y c8 n . . . . . z . jml* jump long to new location dc . . . . . . . . jmp jump to new location 4c 5c 6c 7c . . . . . . . . jsl jump long to subroutine 22 . . . . . . . . jsr jump to subroutine 20 fc . . . . . . . . lda m ? a ad bd b9 af bf a5 a3 b5 b2 a7 b3 a1 b1 b7 a9 n . . . . . z . ldx m ? x ae be a6 b6 a2 n . . . . . z . ldy m ? y ac bc a4 b4 a0 n . . . . . z . lsr 0 ? 15/7 6 5 4 3 2 1 0 ? c 4e 4a 5e 46 56 0 . . . . . z c mvn* m ? m negative 54 . . . . . . . . mvp* m ? m po sitive 44 . . . . . . . . nop no operation ea . . . . . . . . ora a v m ? a 0d 1d 19 0f 1f 05 03 15 12 07 13 01 11 17 09 n . . . . . z .
the western design center, inc. W65C816S data sheet the western d esign center W65C816S 38 table 6 - 5 (continued) operation + add - subtract ^ and processor status code v or a a a,x a,y al al,x (a) (a,x) d d,s d,x d,y (d) [d] (d,s),y (d,x) (d),y [d],y i r rl s xyc # 7 6 5 4 3 2 1 0 mnemonic v exclusive or 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 n v 1 b d i z c pea* mpc+1, mpc+2 ? ms - 1, ms s - 2 ? s f4 . . . . . . . . pei* m(d), m(d+1) ? ms - 1, ms s - 2 ? s d4 . . . . . . . . per* mpc+rl, mpc+rl+1 ? ms - 1, ms s - 2 ? s 62 . . . . . . . . pha a ? ms, s - 1 ? s 48 . . . . . . . . phb dbr ? ms, s - 1 ? s 8b . . . . . . . . phd* d ? ms, ms - 1, s - 2 ? s 0b . . . . . . . . phk* pbr ? ms, s - 1 ? s 4b . . . . . . . . php p ? ms , s - 1 ? s 08 . . . . . . . . phx x ? ms, s - 1 ? s da . . . . . . . . phy y ? ms, s - 1 ? s 5a . . . . . . . . pla s + 1 ? s, ms ? a 68 n . . . . . z . plb * s + 1 ? s, ms ? dbr ab n . . . . . z . pld * s + 2 ? s, ms ? 1, ms ? d 2b n . . . . . z . plp s + 1 ? s, ms ? p 28 n v m x d 1 z c plx s + 1 ? s, ms ? x fa n . . . . . z . ply s + 1 ? s, ms ? y 7a n . . . . . z rep * m^p ? p c2 n v m x d 1 z c rol c ? 15/7 6 5 4 3 2 1 0 ? c 2e 2a 3e 26 36 n . . . . . z c ror c ? 15/7 6 5 4 3 2 1 0 ? c 6e 6a 7e 66 76 n . . . . . z c rti return from interrupt 40 n v m x d 1 z c rtl * return from sub. long 6b . . . . . . . .
the western design center, inc. W65C816S data sheet the western d esign center W65C816S 39 table 6 - 5 (continued) operation + add - subtract ^ and process or status code v or a a a,x a,y al al,x (a) (a,x) d d,s d,x d,y (d) [d] (d,s),y (d,x) (d),y [d].y i r rl s xyc # 7 6 5 4 3 2 1 0 mnemonic v exclusive or 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 n v m x d 1 z c rts return from subroutine 60 . . . . . . . . sbc a - m - (c) ? a ed fd f9 ff e5 e3 f5 f2 e7 f3 e1 f1 f7 e9 n . . . . . z c sec 1 ? c 38 . . . . . . . 1 sed 1 ? d f8 . . . . 1 . . . sei 1 ? 1 78 . . . . . 1 . . sep * mvp ? p e2 n v m x d 1 z c sta a ? m 8d 9d 8f 9f 85 83 95 92 87 93 81 91 97 . . . . . . . . stp stop (1 ? phi2) db . . . . . . . . stx x ? m 8e 86 96 . . . . . . . . sty y ? m 8c 84 94 . . . . . . . . stz 00 ? m 9c 9e 64 74 . . . . . . . . tax a ? x aa n . . . . . z . tay a ? y ab n . . . . . z . tcd * c ? d 5b n . . . . . z . tcs * c ? s 1b . . . . . . . . tdc * d ? c 7b n . . . . . z . trb 1c 14 . . . . . . z . tsb avm ? m 0c 04 . . . . . . z . tsc * s ? c 3b n . . . . . z . tsx s ? x ba n . . . . . z . txa x ? a 8a n . . . . . z .
the western design center, inc. W65C816S data sheet the western d esign center W65C816S 40 table 6 - 5 (continued) operation + add - subtract ^ and processor status code v or a a a,x a,y al al,x (a) (a,x) d d,s d,x d,y (d) [d] (d,s),y (d,x) (d),y [d].y i r rl s xyc # 7 6 5 4 3 2 1 0 mnemonic v exclusive or 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 n v m x d 1 z c txs x ? s 9a . . . . . . . . txy * x ? y 9b n . . . . . z . tya y ? a 98 n . . . . . z . tyx * y ? x bb n . . . . . z . wai 0 ? rdy cb . . . . . . . . wdm * no operation (reserved) 42 . . . . . . . . xba * b ? a eb n . . . . . z . xce * c ? e fb . . . . . . . e notes: 1. bit immediate n and v flags not affected. when m=0, m 15 ? n and m 14 ? v. 2. break bit (b) in status register indicates hardware or software break. * = new w65c816 instruc tions
the western design center, inc. W65C816S data sheet the western design center W65C816S 41 table 6 - 6 addressing mode symbol table sy mbol addressing mode symbol addressing mode # immediate [d] direct indirect long a accumulator [d],y direct indirect long indexed r program counter relative a absolute rl progr am counter relative long a,x absolute indexed with x i implied a,y absolute indexed with y s stack al absolute long d direct al,x absolute long indexed d,x direct indexed with x d,s stack relative d,y direct indexed with y (d,s),y stack relative indir ect indexed (d) direct indirect (a) absolute indirect (d,x) direct indexed indirect (a,x) absolute indexed indirect (d),y direct indirect indexed xyc block move
the western design center, inc. W65C816S data sheet the western design center W65C816S 42 table 6 - 7 6 - 6 instructi on operation (continued on following 6 pages) address mode note cycle vpb mlb vda (14) vpa (14) address bus (15) data bus rwb 1a. absolute a adc, and, bit, cmp, cpx, cpy, eor, lda, ldx ldy ora, sbc, sta, stx, sty, stz, 18 opcodes, 3 bytes, 4 & 5 cycle s (1) 1 2 3 4 4a 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 pbr,pc pbr,pc+1 pbr,pc+2 dbr,aa dbr,aa+1 opcode aal aah data low data high 1 1 1 1/0 1/0 1b. absolute a jmp (4c) 1 opcode, 3 bytes, 3 cycles 1 2 3 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 pbr,pc pbr,p c+1 pbr,pc+2 pbr,new pc opcode new pcl new pch opcode 1 1 1 1 1c. absolute a jsr 1 opcode, 3 bytes, 6 cycles (different order from n6502) 1 2 3 4 5 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 pbr,pc pbr,pc+1 pbr,pc+2 pbr,pc+2 0,s 0,s - 1 pb r,newpc opcode new pcl new pch io pch pcl next opcode 1 1 1 1 0 0 1 1d. absolute (r - m - w) a asl, dec, inc, lsr, rol, ror, trb, tsb 6 opcodes, 3 bytes, 6 & 8 cycles (1) (3)(17) (1) 1 2 3 4 4a 5 6a 6 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 1 1 0 1 1 1 1 1 0 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+2 dbr,aa dbr,aa+1 dbr,aa+1 dbr,aa+1 dbr,aa opcode aal aah data low data high io data high data low 1 1 1 1 1 1 0 0 2a. absolute indexed indirect (a,x) jmp 1 opcode, 3 bytes, 6 cycles 1 2 3 4 5 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 pbr,pc pbr - pc+1 pbr - pc+2 pbr,pc+2 pbr,aa+x pbr,aa+x+1 pbr,new pc opcode aal aah io new pcl new pch opcode 1 1 1 1 1 1 1 2b. absolute indexed indirect (a,x) jsr 1 opcode, 3 bytes, 8 cycles 1 2 3 4 5 6 7 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 0 0 1 1 1 0 0 1 0 1 1 1 pbr,pc pbr,pc+1 0,s 0,s - 1 pbr,pc+2 pbr,pc+2 pbr,aa+x pbr,aa+x+1 pbr,new pc opcode aal pch pcl aah io new pcl new pch next opcode 1 1 0 0 1 1 1 1 1 3a. absolute indirect (a) jml 1 opcode, 3 bytes, 6 cycles 1 2 3 4 5 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 1 pbr,pc pbr,pc+1 pbr,pc+2 0,aa 0,aa+1 0,aa+2 new pbr,pc opcode aal aah new pcl new pch new pbr opcode 1 1 1 1 1 1 1 3b. absolute indirect (a) jmp 1 opcode, 3 bytes, 5 cycles 1 2 3 4 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 pbr,pc pbr,pc+1 pbr,pc+2 0,aa 0,aa+1 pbr,new pc opcode aal aah new pcl new pch opcode 1 1 1 1 1 1 (see table 6.8 for abbreviations.)
the western design center, inc. W65C816S data sheet the western design center W65C816S 43 table 6 - 7 (continued) address mode note cycle vpb mlb vda (1 4) vpa (14) address bus (15) data bus rwb 4a. absolute long al adc, and, cmp, eor, lda, ora, sbc, sta, 8 opcodes, 4 bytes, 5 & 6 cycles (1) 1 2 3 4 5 5a 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 pbr,pc pbr,pc+1 pbr,pc+2 pbr,pc+3 aab,aa aab,aa+ 1 opcode aal aah aab data low data high 1 1 1 1 1/0 1/0 4b. absolute long (jump) al jmp 1 opcode, 4 bytes, 4 cycles 1 2 3 4 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 pbr,pc pbr,pc+1 pbr,pc+2 pbr,pc+3 new pbr,pc opcode new pcl new pch new br opcode 1 1 1 1 1 4c. absolute long (jump to subroutine long) al jsl 1 opcode, 4 bytes, 7 cycles 1 2 3 4 5 6 7 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 0 0 1 0 0 1 pbr,pc pbr,pc+1 pbr,pc+2 0,s 0,s pbr,pc+3 0,s - 1 0,s - 2 new pbr,pc opcode new pcl n ew pch pbr io new pbr pch pcl next opcode 1 1 1 0 1 1 0 0 1 5. absolute long,x al,x adc, and, cmp, eor, lda, ora, sbc, sta 8 opcodes, 4 bytes, 5 and 6 cycles (1) 1 2 3 4 5 5a 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 pbr,pc pbr,pc+1 pbr,pc+2 pb r,pc+3 aab,aa+x aab,aa+x+1 opcode aal aah aab data low data high 1 1 1 1 1/0 1/0 6a absolute, x a, x adc, and, bit, cmp, eor, lda, ldy, ora, sbc, sta, sta, stz 12 opcodes, 3 bytes, 4,5 and 6 cycles (4) (1) 1 2 3 3a 4 4a 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 pbr,pc pbr,pc+1 pbr,pc+2 dbr,aah,aal+xl dbr,aa+x dbr,aa+x+1 opcode aal aah io data low data high 1 1 1 1 1/0 1/0 6b absolute, x(r - m - w) a,x asl, dec inc lsr rol, ror 6 opcodes, 3 bytes, 7 and 9 cycles (1) (3)(17) (1) 1 2 3 4 5 5a 6 7a 7 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 1 1 0 1 1 1 1 1 0 0 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+2 dbr,aah,aal+xl dbr,aa+x dbr,aa+x+1 dbr,aa+x+1 dbr,aa+x+1 dbr,aa+x opcode aal aah io data low date high io data high data low 1 1 1 1 1 1 1 0 0 7. absolu te, y a,y adc, and, cmp, eor, lda, ldx, ora, sbc, sta 9 opcodes, 3 bytes, 4,5 and 6 cycles (4) (1) 1 2 3 3a 4 4a 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 pbr,pc pbr,pc+1 pbr,pc+2 dbr,aah,aal+yl dbr,aa+y dbr,aa+y+1 opcode aal aah io data low data high 1 1 1 1 1/0 1/0 8. accumulator a asl, dec, inc, lsr, rol, ror 6 opcodes, 1 byte, 2 cycles 1 2 1 1 1 1 1 0 1 0 pbr,pc pbr,pc+1 opcode io 1 1 (see table 6 - 8 for abbreviations)
the western design center, inc. W65C816S data sheet the western design center W65C816S 44 table 6 - 7 (continued) address mode note cycle vpb mlb vda (14) vpa (14) address bus (15) data bus rwb 9a. block move negative (backward) xyc mvn 1 op code n - 2 3 bytes byte 7 cycles c=2 x=source address y=destination c=# of bytes to move - 1 x,y increment n byte c=0 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 pbr,pc pbr,pc+1 pbr,pc+2 sba,x dba,y dba,y dba,y pbr,pc pbr,pc+1 pbr,pc+2 sba,x+1 dba,y+1 dba,y+1 dba,y+1 pbr,pc pbr,pc+1 pbr,pc+2 sba,x+2 dba,y+2 dba,y+2 dba ,y+2 pbr,pc+3 opcode dba sba src data dest data io io opcode dba sba src data dest data io io opcode dba sba src data dest data io io next opcode 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 9b. block move positive (forward) xyc (mvp) 1 op code n - 2 3 bytes byte 7 cycles c=2 x=source address y=destination c=# of bytes to move - 1 x,y decrement mvp is used when the destination n - 1 start address is higher (more byte positive ) than the source c=1 start address. n byte last c=0 000000 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 pbr,pc pbr,pc+1 pbr,pc+2 sba,x dba,y dba,y dba,y pbr,pc pbr,pc+1 pbr,pc+2 sba,x - 1 dba,y - 1 dba,y - 1 dba,y - 1 pbr,pc pbr,pc+1 pbr,pc+2 sba,x - 2 dba,y - 2 dba,y - 2 dba,y - 2 pbr,pc+3 opcode dba sba src data dest data io io opcode dba sba src data dest data io io op code dba sba src data dest data io io next opcode 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 (see table 6 - 7 for abb reviations) source end dest. end source start dest. start dest ination . start source start dest ination . end ffffff 000000 ffffff
the western design center, inc. W65C816S data sheet the western design center W65C816S 45 table 6 - 7 (continued) address mode note cycle vpb mlb vda (14) vpa (14) address bus (15) data bus rwb 10a. direct d adc and bit, cmp, cpx, cpy ,eor, lda, ldx, ldy, ora, sbc, sta, stx, sty, stz 16 opcodes, 2 bytes, 3, 4 & 5 cycles (2) (1) 1 2 2a 3 3a 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 0,d+do 0,d+do+1 opcode do io data low data high 1 1 1 1/0 1/0 10b. direct (r - m - w)d asl, dec, inc, lsr, rol, ror, trb, tsb, 8 opcodes, 2 bytes, 5,6,7 and 8 cycles (2) (1) ( 3),(17) (1) 1 2 2a 3 3a 4 5a 5 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 pbr, pc pbr,pc+1 pbr,pc+1 0,d+do 0,d+do+1 0,d+do+1 0,d+do+1 0,d+do opcode do io data low data high io data high data low 1 1 1 1 1 1 0 0 11. direct indexed indi rect (d,x) adc, and, cmp, eor, lda, ora, sbc, sta, 8 opcodes, 2 bytes, 6,7 and 8 cycles (2) (1) 1 2 2a 3 4 5 6 6a 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 pbr,pc+1 0,d+do+x 0,d+do+x+1 dbr,aa dbr,aa+1 op code do io io aal aah data low data high 1 1 1 1 1 1 1/0 1/0 12. direct indirect (d) adc, and, cmp, eor, lda, ora, sbc. sta, 8 opcodes 2 bytes, 5,6 and 7 cycles (2) (1) 1 2 2a 3 4 5 5a 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 pbr,pc pb r,pc+1 pbr,pc+1 0,d+do 0,d+do+1 dbr,aa dbr,aa+1 opcode do io aal aah data low data high 1 1 1 1 1 1/0 1/0 13. direct indirect indexed (d),y adc, and, cmp, eor, lda, ora, sbc, sta 8 opcodes, 2 bytes, 5,6,7 and 8 cycles (2) (4) (1) 1 2 2a 3 4 4a 5 5a 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 0,d+do 0,d+do+1 dbr,aah.aal+yl dbr,aa+y dbr,aa+y+1 opcode do io aal aah io data low data high 1 1 1 1 1 1 1/0 1/0 14. direct indirect indexed long [d],y adc, and, cmp, eor, lda, ora, sbc, sta 8 opcodes, 2 bytes, 6,7 and 8 cycles (2) (1) 1 2 2a 3 4 5 6 6a 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 0,d+do 0,d+do+1 0,d+do+2 aab,aa+y aab,aa+y+1 opcode do io aal aah aab dat a low data high 1 1 1 1 1 1 1/0 1/0 15. direct indirect long [d] adc, and, cmp, eor, lda, ora, sbc, sta 8 opcodes, 2 bytes, 6,7 and 8 cycles (2) (1) 1 2 2a 3 4 5 6 6a 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 pbr,pc pbr,pc+1 pb r,pc+1 0,d+do 0,d+d0+1 0,d+do+2 aab,aa aab,aa+1 opcode do io aal aah aab data low data high 1 1 1 1 1 1 1/0 1/0 (see table 6 - 8 for abbreviations)
the western design center, inc. W65C816S data sheet the western design center W65C816S 46 table 6 - 7 (continued) address mode note cycle vpb mlb vda (14) vpa (14) address bus (15) data bus rwb 1 6a. direct, x d,x adc, and, bit, cmp, eor, lda ldy, ora, sbc, sta, sty, stz, 12 opcodes,2 bytes, 4,5,and 6 cycles (2) (1) 1 2 2a 3 4 4a 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 pbr,pc+1 0,d+do+x 0,d+do+x+1 opcode do io i o data low data high 1 1 1 1 1/0 1/0 16b. direct, x (r - m - w) d,x asl, dec, inc, lsr, rol, ror, 6 opcodes, 2 bytes, 6,7,8 and 9 cycles (2) (1) (3),(17) (1) 1 2 2a 3 4 4a 5 6a 6 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 pbr, pc pbr,pc+1 pbr,pc+1 pbr,pc+1 0,d+do+x 0,d+do+x+1 0,d+do+x+1 0,d+do+x+1 0,d+do+x opcode do io io data low data high io data high data low 1 1 1 1 1 1 1 0 0 17. direct, y d,y ldx, stx 2 opcodes, 2 bytes, 4,5 and 6 cycles (2) (1) 1 2 2a 3 4 4a 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 pbr,pc+1 0,d+do+y 0,d+do+y+1 opcode do io io data low data high 1 1 1 1 1/0 1/0 18.immediate # adc, and, bit, cmp, cpx, cpy, eor, lda, ldx, ldy, ora, rep, sec, sep 14 opcodes, 2 and 3 bytes, 2 and 3 cycles (1)(6) 1 2 2a 1 1 1 1 1 1 1 0 0 1 1 1 pbr,pc pbr,pc+1 pbr,pc+2 opcode idl idh 1 1 1 19a. implied i clc, cld, cli, clv, dex, dey, inx, iny, nop, sec, sed, sei, tax, tay, tcd, tcs, tdc, tsc, tsx, txa, txs, txy, tya, tyx, xce 25 opcodes, 1 b yte, 2 cycles 1 2 1 1 1 1 1 0 1 0 pbr,pc pbr,pc+1 opcode io 1 1 19b. implied i xba 1 opcode, 1 byte, 3 cycles 1 2 3 1 1 1 1 1 1 1 0 0 1 0 0 pbr,pc pbr,pc+1 pbr,pc+1 opcode io io 1 1 1 19c. stop the clock stp 1 opcode 1 byte resb=1 3 cycles resb=0 resb=0 resb=1 (see 22a. stack hardware interrupt) 1 2 3 1c 1b 1a 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 pbr,pc pbr,pc+1 pbr,pc+1 pbr,pc+1 pbr,pc+1 pbr,pc+1 pbr,pc+1 opcode io io res (brk) res (brk) res (brk) begin 1 1 1 1 1 1 1 19d. wait for interrupt wai 1 opcode,1 byte 3 cycles irqb, nmib rdy=1 (9)rdy=1 rdy=0 rdy=1 1 2 3 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 pbr,pc pbr,pc+1 pbr,pc+1 pbr,pc+1 opcode io io irq(brk) 1 1 1 1 (see table 6 - 8 for abbreviations
the western design center, inc. W65C816S data sheet the western design center W65C816S 47 table 6 - 7 (continued) address mode note cycle vpb mlb vda (14) vpa (14) address bus (15) data bus rwb 20. relative r bcc , bcs, beq, bmi, bne, bpl, bra, bvc,bvs 9 opcodes, 2 bytes, 2,3 and 4 cycles (5) (6) 1 2 2a 2b 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 1 pbr,pc pbr,pc+1 pbr,pc+1 pbr,pc+1 pbr,pc+offset opcode offset io io opcode 1 1 1 1 1 21. relative long rl brl 1 opco de, 3 bytes, 4 cycles 1 2 3 4 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 1 pbr,pc pbr,pc+1 pbr,pc+2 pbr,pc+2 pbr,pc+offset opcode offset low offset high io opcode 1 1 1 1 1 22a. stack s abort, irq, nmi, res 4 hardware interrupts 0 bytes, 7 and 8 cycles (3) (7) (10) (10) (10) (11) 1 2 3 4 5 6 7 8 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 pbr,pc pbr,pc 0,s 0,s - 1 0,s - 2 0.s - 3 0,va 0,va+1 0,aav io io pbr pch pcl p aavl aavh next opcode 1 1 0 0 0 0 1 1 1 22b. stack s pla, plb, pld, plp, plx, ply different than n6502 6 op codes,1 byte, 4 and 5 cycles (1) 1 2 3 4 4a 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 0,s+1 0,s+2 opcode io io reg low reg high 1 1 1 1 1 22c. stack s pha, phb php, phd, phk, phx, phy 7 o p codes, 1 byte, 3 and 4 cycles (1) (12) 1 2 3a 3 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 0 pbr,pc pbr,pc+1 0,s 0,s - 1 opcode io reg high reg low 1 1 1 1 22d. stack s pea 1 op code, 3 bytes, 5 cycles 1 2 3 4 5 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 pbr,pc pbr,pc+ 1 pbr,pc+2 0,s 0,s - 1 opcode aal aah aah aal 1 1 1 0 0 22e. stack s pei 1 op code, 2 bytes, 6 and 7 cycles (2) 1 2 2a 3 4 5 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 0,d+do 0,d+do+1 0,s 0,s - 1 opcode do io aal aah aah aal 1 1 1 1 1 0 0 22f. stack s per 1 op code, 3 bytes, 6 cycles 1 2 3 4 5 6 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 pbr,pc pbr,pc+1 pbr,pc+2 pbr,pc+2 0,s 0,s - 1 opcode offset low offset high io pch+offset+carry pcl+offset 1 1 1 1 0 0 (see ta ble 6 - 8 for abbreviations)
the western design center, inc. W65C816S data sheet the western design center W65C816S 48 table 6 - 7 (continued) address mode note cycle vpb mlb vda (14) vpa (14) address bus (15) data bus rwb 22g. stack s rti 1 op code, 1 byte, 6 and 7 cycles (different order fromn6502) (3) (7) 1 2 3 4 5 6 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 pbr,pc pbr,pc+1 pbr,pc+1 0,s+1 0,s+2 0,s+3 0,s+4 pbr,new pc opcode io io p new pcl new pch pbr next opcode 1 1 1 1 1 1 1 1 22h. stack s rts 1 opcode, 1 byte, 6 cycles 1 2 3 4 5 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 0 0 0 0 1 pbr,pc pbr,pc+1 pbr,pc+1 0,s+1 0,s+2 0,s+2 pbr,pc opcode io io pcl pch io opcode 1 1 1 1 1 1 1 22i. stack s rtl 1 op code, 1 byte, 6 cycles 1 2 3 4 5 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 0 1 pbr,pc pbr, pc+1 pbr,pc+1 0,s+1 0,s+2 0,s+3 new pbr,pc opcode io io new pcl new pch new pbr next opcode 1 1 1 1 1 1 1 22j. stack s brk,cop 2 opcodes, 2 bytes 7 and 8 cycles (3) (7) (10) (10) (10) 1 2 3 4 5 6 7 8 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 pbr,pc pbr,pc+1 0,s 0,s - 1 0,s - 2 0,s - 3 (16) 0,va 0,va+1 0,aav opcode signature pbr pch pcl p aavl aavh next opcode 1 1 0 0 0 0 1 1 1 23. stack relative d,s adc, and, cmp, eor, lda, ora, sbc, sta 8 op codes, 2 bytes, 4 and 5 cycles ( 1) 1 2 3 4 4a 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 0,s+so 0,s+so+1 opcode so io data low data high 1 1 1 1/0 1/0 24. stack relative indirect indexed (d,s),y adc, and, cmp, eor, lda, ora, sbc, sta 8 op codes, 2 bytes, 7 and 8 cy cles (1) 1 2 3 4 5 6 7 7a 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 pbr,pc pbr,pc+1 pbr,pc+1 0,s+so 0,s+so+1 0,s+so+1 dbr,aa+y dbr,aa+y+1 opcode so io aal aah io data low data high 1 1 1 1 1 1 1/0 1/0 (see table 6 - 8 for abbre viations)
the western design center, inc. W65C816S data sheet the western design center W65C816S 49 notes: be aware that notes #4 - 7, 9 and 10 apply to the w65c02s and W65C816S. all other notes apply to the W65C816S only. 1. add 1 byte (for immediate only) for m=0 or x=0 (i.e. 16 - bit data), add 1 cycle for m=0 or x=0. rep, sep are alway s 3 cycle instructions and vpa is low during the third cycle. the address bus is pc+1 during the third cycle. 2. add 1 cycle for direct register low (dl) not equal 0. 3. special case for aborting instruction. this is the last cycle which may be aborted or the status, pbr or dbrregisters will be updated. 4. add 1 cycle for indexing across page boundaries, or write, or x=0. when x=1 or in the emulation mode, this cycle contains invalid addresses. 5. add 1 cycle if branch is taken. 6. add 1 cycle if branch is taken across page boundaries in 6502 emulation mode (e=1). 7. subtract 1 cycle for 6502 emulation mode (e=1). 8. add 1 cycle for rep, sep. 9. wait at cycle 2 for 2 cycles after nmib or irqb active input. 10. rwb remains high during reset. 11. brk bit 4 equals "0" in emulation mode. 12. ph p and plp. 13. some opcodes shown are compatible only with the W65C816S. 14. vda and vpa are not valid outputs on the w65c02s but are valid on the W65C816S. the two signals, vda and vpa, are included to point out the upward compatibility to the W65C816S. when vd a and vpa are both a one level, this is equivalent to sync being a one level. 15. the pbr is only applicable to the W65C816S. 16. cop latches. 17. in the emulation mode, during a r - m - w instruction the rwb is low during both write and modify cycles.
the western design center, inc. W65C816S data sheet the western design center W65C816S 50 table 6 - 8 abbreviations abbreviation explanation aab absolute address bank aah absolute address high aal absolute address low aavh absolute address vector high aavl absolute address vector low c accumulator d direct register dba destination bank address dbr data bank address dest destination do direct offset idh immediate data high idl immediate data low io internal operation off offset p status register pbr program bank register pc program counter pch program counter high pcl program counter low r - m - w read - modify - write reg register s stack address sba source bank address src source so stack offset va vector address x,y index register
the western design center, inc. W65C816S data sheet the western design center W65C816S 51 figure 6 - 1 bank address latching circuit phi2 W65C816S d0 - d7 ba0 - ba7 r/wb clock 8 74x245 e d q 8 bank address ba0 - ba7 oe ce b a dir 573 or 373 8 data bus d0 - d7
the western design center, inc. W65C816S data sheet the western design center W65C816S 52 7 recommended W65C816S assembler syntax standards 7.1 directives assembler directives are those parts of the assembly language source program which give directions to the as sembler; this includes the definition of data area and constants within a program. this standard excludes any definitions of assembler directives. 7.2 comments an assembler should provide a way to use any line of the source program as a comment. the re commended way of doing this is to treat any blank line, or any line that starts with a semi - colon or an asterisk as a comment. other special characters may be used as well. 7.3 the source line any line which causes the generation of a single W65C816S ma chine language instruction should be divided into four fields: a label field, the operation code, the operand, the comment field. 7.3.1 the label field the label field begins in column one of the line. a label must start with an alphabetic character, an d may be followed by zero or more alphanumeric characters. an assembler may define an upper limit on the number of characters that can be in a label, so long as that upper limit is greater than or equal to six characters. an assembler may limit the alpha betic characters to upper - case characters if desired. if lower - case characters are allowed, they should be treated as identical to their upper - case equivalents. other characters may be allowed in the label, so long as their use does not conflict with the coding of operand fields. 7.3.2 the operation code field the operation code shall consist of a three character sequence (mnemonic) from table 7 - 1. it shall start no sooner than column 2 of the line, or one space after the label if a label is coded. 7. 3.2.1 many of the operation codes in table 6 - 1 have duplicate mnemonics; when two or more machine language instruction has the same mnemonic, the assembler resolves the difference based on the operand. 7.3.2.2 if an assembler allows lower - case le tters in labels, it must also allow lower - case letters in the mnemonic. when lower - case letters are used in the mnemonic, they shall be treated as equivalent to the upper - case counterpart. thus, the mnemonics lda, lda and lda must all be recognized, and are equivalent. 7.3.2.3 in addition to the mnemonics shown in table 7 - 1, an assembler may provide the alternate mnemonics shown in table 7 - 1.
the western design center, inc. W65C816S data sheet the western design center W65C816S 53 table 7 - 1 alternate mnemonics wdc standard alias bcc blt bcs bge cmp a cma dec a dea inc a ina jsl jsr jml jmp tcd tad tcs tas tdc tda tsc tsa xba swa 7.3.2.4 jsl should be recognized as equivalent to jsr when it is specified with a long absolute address forced. jml is equivalent to jmp with long addressing forced . 7.3.3 the operand field the operand field may start no sooner than one space after the operation code field. the assembler must be capable of at least twenty - four bit address calculations. the assembler should be capable of spe cifying addresses as labels, integer constants, and hexadecimal constants. the assembler must allow addition and subtraction in the operand field. labels shall be recognized by the fact they start with alphabetic characters. decimal numbers shall be reco gnized as containing only the decimal digits 0...9. hexadecimal constants shall be recognized by prefixing the constant with a "$" character, followed by zero or more of either the decimal digits or the hexadecimal digits "a"..."f". if lower - case letters are allowed in the label field, then they shall also be allowed as hexadecimal digits. 7.3.3.1 all constants, no matter what their format, shall provide at least enough precision to specify all values that can be represented by a twenty - four bit signed or unsigned integer represented in two's complement notation. 7.3.3.2 table 7 - 2 shows the operand formats that shall be recognized by the assembler. bol d is a label or value which the assembler can recognize as being less than $100. the symbol a is a l abel or value which the assembler can recognize as greater than $ff but less than $10000; the symbol al is a label or value that the assembler can recognize as being greater than $fff. the symbol ext is a label which cannot be located by the assembler at the time the instruction is assembled. unless instructed otherwise, an assembler shall assume that ext labels are two bytes long. the symbols r and rl are 8 and 16 bit signed displacements calculated by the assembler.
the western design center, inc. W65C816S data sheet the western design center W65C816S 54 table 7 - 2 address mode formats addressing mode format addressing mode format immediate #d absolute indexed by y !d,y #a d,y #al a,y #ext !a,y #d,x #>d >a,x #>a >al,x #>al al,x #>ext >ext,x #^d program counter relative d #^a and program counter a #^al relative long al #^ext (ext) absolute !d absolute indirect (d) !a (!d) a (a) !al (!a) !ext (!al) ext ext absolute long >d direct indirect (d ) >a (al (ext direct indirect long [d] direct page d [>a] al] ext] the western design center, inc. W65C816S data sheet the western design center W65C816S 55 7.3.3.3 note that the operand does not determine whether or not immediate address loads one or two bytes, this is determined by the setting of the status register. this forces the requirement for a directive or directives that tell the assembler to generate one or two bytes of space for immediate loads. the directives provided shall allow separate se ttings for the accumulator and index registers. 7.3.3.4 the assembler shall use the <, >, and ^ characters after the # character in immediate address to specify which byte or bytes will be selected from the value of the operand. any calculations in the operand must be performed before the byte selection takes place. table 7 - 3 defines the action taken by each operand by showing the effect of the operator on an address. the column that shows a two byte immediate value show the bytes in the order in which they appear in memory. the coding of the operand is for an assembler which uses 32 - bit address calculations, showing the way that the address should be reduced to a 24 - bit value. table 7 - 3 byte selection op erator operand one byte result two byte result #$01020304 04 04 03 #<$01020304 04 04 03 #>$01020304 03 03 02 #^$01020304 02 02 01 7.3.3.5 in any location in an operand where an address, or expression resulting in an address, can be coded, the ass embler shall recognize the prefix characters <, |, and >, which force one byte (direct page), two byte (absolute) or three byte (long absolute) addressing. in cases where the addressing modes is not forced, the assembler shall assume that the address is tw o bytes unless the assembler is able to determine the type of addressing required by context, in which case that addressing mode will be used. addresses shall be truncated without error in an addressing mode is forced which does not require the entire va lue of the address. for example, lda $0203 and lda |$010203 are completely equivalent. if the addressing mode is not forced, and the type of addressing cannot be determined from context, the assembler shall assume that a two byte address is to be used. i f an instruction does not have a short addressing mode (as in lda< which has no direct page indexed by y) and a short address is used in the operand, the assembler shall automatically extend the address by padding the most significant bytes with zeroes in order to extend the address to the length needed. as with immediate address, any expression evaluation shall take place before the address is selected; thus, the address selection character is only used once, before the address of expression. 7.3.3.6 t he (!) exclamation point character should be supported as an alternative to the | (vertical bar). 7.3.3.7 a long indirect address is indicated in the operand field of an instruction field of an instruction by surrounding the direct page address where th e indirect address is found by square brackets; direct page addresses which contain sixteen - bit addresses are indicated by being surrounded by parentheses. 7.3.4 comment field the comment field may start no sooner than one space after the operation code f ield or operand field depending on instruction type.
the western design center, inc. W65C816S data sheet the western design center W65C816S 56 8 caveats table 8 - 1 caveats compatibility issue nmos 6502 w65c02 w65c02s W65C816S s (stack) always page 1, 8 bits always page 1, 8 bits always page 1, 8 b its always page 1 8 bits when(e=1), 16 bits when e=0 x (x index reg) always page 0 always less than 256 ie 8 bits always page 0 always less than 256 ie 8 bits always page 0 always less than 256 ie 8 bits indexed page zero always in page 0 (e=1), cross pag e (e=0) y (y index reg) always page 0 always less than 256 ie 8 bits always page 0 always less than 256 ie 8 bits always page 0 always less than 256 ie 8 bits indexed page zero always in page 0 (e=1), cross page (e=0) a (accumulator) 8 bits 8 bits 8 bits 8 bits (m=1), 16 bits (m=0) (flag reg) n, v and z flags invalid in decimal mode. d=unknown after reset. d not modified after interrupt n,v and z flags valid in decimal mode. d=0 after reset/interrupt n,v and z flags valid in decimal mode. d=0 after reset /interrupt n,v and z flags valid in decimal mode. d=0 after reset/interrupt timing a.abs,x,asl,lsr, rol with no page crossing b. jump indirect operand =xxff c. branch across page d. decimal mode 7 cycles 5 cycles and invalid page crossing 4 cycles no ad d. cycles 6 cycles 6 cycles 4 cycles add 1 cycle 6 cycles 6 cycles 4 cycles add 1 cycle 7 cycles 5 cycles 4 cycles no add. cycles brk vector fffe,f brk bit=0 on stack if irq, nmi fffe,f brk bit=0 on stack if irq, nmi fffe,f brk bit=0 on stack i f irq, nmi 00fffe,f(e=1) brk bit=0 on stack if irq - nmib, abortb 000ffe6,7 (e=0), x=x on stack always interrupt or break bank address not available not available not available pbr not pushed (e=1) rti, pbr, not pulled (e - 1) prb pushed (e=0) rti, pbr pulle d (e=0) memory lock (ml) not available mlb=0 during modify and write cycles mb=0 during modify and write cycles mlb=0 during read modify and write cycles indexed across page boundary (d),y a,x a,y extra read of invalid address extra read of last instruct ion fetch extra read of last instruction fetch extra read of invalid address rdy pulled during write cycle ignored processor stops processor stops processor stops
the western design center, inc. W65C816S data sheet the western design center W65C816S 57 8.1 stack addressing when in the native mode, the stack may use memory locations 000000 to 00fffff. the effective address of stack, stack relative, and stack relative indirect indexed addressing modes will always be within this range. in the emulation mode, the stack address range is 000100 to 0001ff. the following opcodes and addressing mod es will increment or decrement beyond this range when accessing two or three bytes: jsl, jsr (a,x), pea, pei, per, phd, pld, rtl 8.2 direct addressing 8.2.1 the direct addressing modes are often used to access memory registers and pointers. the effective address generated by direct; direct,x and direct,y addressing modes will always be in the native mode range 000000 to 00ffff. when in the emulation mode, the direct addressing range is 000000 to 0000ff, except for [direct] and [direct],y addressing modes and the pei instruction which will increment from 0000fe or 0000ff into the stack area. 8.2.2 when in the emulation mode and dh is not equal to zero, the direct addressing range is 00dh00 to 00dhff, except for [direct] and [direct],y addressing modes and the pei instruction which will increment from 00dhfe or 00dhff into the next higher page. 8.2.3 when in the emulation mode and dl in not equal to zero, the direct addressing range is 000000 to 00ffff. 8.3 absolute indexed addressing the absolute indexed add ressing modes are used to address data outside the direct addressing range. the w65c02s addressing range is 0000 to ffff. indexing from page ffxx may result in a 00yy data fetch when using the w65c02s. in contrast, indexing from page zzffxx may result i n zz+1,00yy when using the W65C816S. 8.4 abortb input 8.4.1 abortb should be held low for a period not to exceed one cycle. also, if abortb is held low during the abort interrupt sequence, the abort interrupt will be aborted. it is not recommended to abor t the abort interrupt. the abortb internal latch is cleared during the second cycle of the abort interrupt. asserting the abortb input after the following instruction cycles will cause registers to be modified: 8.4.1.1 read - modify - write: processor sta tus modified if abortb is asserted after a modify cycle. 8.4.1.2 rti: processor status modified if abortb is asserted after cycle 3. 8.4.1.3 irqb, nmib, abortb brk, cop: when abortb is asserted after cycle 2, pbr and dbr will become 00 (emulation mod e) or pbr will become 00 (native mode). 8.4.2 the abort interrupt has been designed for virtual memory systems. for this reason, asynchronous abortb's may cause undesirable results due to the above conditions 8.5 vda and vpa valid memory address output signa ls when vda or vpa are high and during all write cycles, the address bus is always valid. vda and vpa should be used to qualify all memory cycles. note that when vda and vpa are both low, invalid addresses may be generated. the page and bank addresses could also be invalid. this will be due to low byte addition only. the cycle when only low byte addition occurs is an optional cycle for instructions which read memory when the index register consists of 8 bits. this optional cycle becomes a standard cyc le for the store instruction, all instructions using the 16 - bit index register mode, and the read - modify - write instruction when using 8 - or 16 - bit index register modes.
the western design center, inc. W65C816S data sheet the western design center W65C816S 58 8.6 db/ba operation when rdy is pulled low when rdy is low, the data bus is held in the data transfer state (i.e. phi2 high). the bank address external transparent latch should be latched on the rising edge of the phi2 clock. 8.7 mx output the mx output reflects the value of the m and x bits of the processor status register. the rep, sep and plp instructions may change the state of the m and x bits. note that the mx output is invalid during the instruction cycle following rep, sep and plp instruction execution. this cycle is used as the opcode fetch cycle of the next instruction. 8.8 all opcode s function in all modes of operation 8.7.1 it should be noted that all opcodes function in all modes of operation. however, some instructions and addressing modes are intended for W65C816S 24 - bit addressing, and are therefore less useful for the emulati on mode. the jsl, rtl, jmp al and jml instructions and addressing modes are primarily intended for W65C816S native mode use. 8.7.2 the following instructions may be used with the emulation mode even though a bank address is not multiplexed on the data bu s: phk, phb and plb 8.7.3 the following instructions have "limited" use in the emulation mode: 8.7.3.1 the rep and sep instructions cannot modify the m and x bits when in the emulation mode. in this mode the m and x bits will always be high (logic 1). 8.7.3.2 when in the emulation mode, the mvp and mvn instructions use the x and y index registers for the memory address. also, the mvp and mvn instructions can only move data within the memory range 0000 (source bank) to 00ff (destination bank) for the W65C816S, and 0000 to 00ff for the emulation mode. 8.9 indirect jumps the jmp (a) and jml (a) instructions use the direct bank for indirect addressing, while jmp (a,x) and jsr (a,x) use the program bank for indirect address tables. 8.10 switching modes when s witching from the native mode to the emulation mode, the x and m bits of the status register are set high (logic 1), the high byte of the stack is set to 01, and the high bytes of the x and y index registers are set to 00. to save previous values, these b ytes must always be stored before changing modes. note that the low byte of the s, x and y registers and the low and high byte of the accumulator (a and b) are not affected by a mode change. 8.11 how interrupts affect the program bank and the data bank regist ers 8.11.1 when in the native mode, the program bank register (pbr) is cleared to 00 when a hardware interrupt, brk or cop is executed. in the native mode, previous pbr contents are automatically saved on stack. 8.11.2 in the emulation mode, the pb r and dbr registers are cleared to 00 when a hardware interrupt, brk or cop is executed. in this case, previous contents of the pbr are not automatically saved. 8.11.3 note that a return from interrupt (rti) should always be executed from the same "mode " which originally generated the interrupt.
the western design center, inc. W65C816S data sheet the western design center W65C816S 59 8.12 binary mode the binary mode is set whenever a hardware or software interrupt is executed. the d flag within the status register is cleared to zero. 8.13 wai instruction the wai instruction pulls rdy low and plac es the processor in the wai "low power" mode. nmib, irqb or resb will terminate the wai condition and transfer control to the interrupt handler routine. note that an abortb input will abort the wai instruction, but will not restart the processor. when t he status register i flag is set (irqb disabled) the irqb interrupt will cause the next instruction (following the wai instruction) to be executed without going to the irqb interrupt handler. this method results in the highest speed response to an irqb in put. when an interrupt is received after an abortb which occurs during the wai instruction, the processor will return to the wai instruction. other than resb (highest priority), abortb is the next highest priority, followed by nmib or irqb interrupts. 8.14 t he stp instruction the stp instruction disables the phi2 clock to all internal circuitry. when disabled, the phi2 clock is held in the high state. in this case, the data bus will remain in the data transfer state and the bank address will not be multip lexed onto the data bus. upon executing the stp instruction, the resb signal is the only input which can restart the processor. the processor is restarted by enabling the phi2 clock, which occurs on the falling edge of the resb input. note that the exte rnal oscillator must be stable and operating properly before resb goes high. 8.15 cop signatures signatures 00 - 7f may be user defined, while signatures 80 - ff are reserved for instructions on future microprocessors. contact wdc for software emulation of futur e microprocessor hardware functions. 8.16 wdm opcode use the wdm opcode may be used on future microprocessors. it performs no operation. wdm are the initials of william d. mensch, jr., the founder of wdc. 8.17 rdy pulled during write the nmos 6502 does not sto p during a write operation. in contrast, both the w65c02s and the W65C816S do stop during write operations 8.18 mvn and mvp affects on the data bank regist er the mvn and mvp instructions change the data bank register to the value of the second byte of the in struction (destination bank address).
the western design center, inc. W65C816S data sheet the western design center W65C816S 60 8.19 interrupt priorities the following interrupt priorities will be in effect should more than one interrupt occur at the same time: highest priority lowest priority resb abortb, nmib, irqb 8.20 transfers from 8 - bit to 1 6 - bit, or 16 - bit to 8 - bit registers all transfers from one register to another will result in a full 16 - bit output from the source register. the destination register size will determine the number of bits actually stored in the destination register and t he values stored in the processor status register. the following are always 16 - bit transfers, regardless of the accumulator size: tcs, tsc, tcd and tdc note: php and plp are always 8 bit operations. 8.21 stack transfers when in the emulation mode, a 01 is forced into sh. in this case, the b accumulator will not be loaded into sh during a tcs instruction. when in the native mode, the b accumulator is transferred to sh. note that in both the emulation and native modes, the full 16 bits of the stack registe r are transferred to the a, b and c accumulators, regardless of the state of the m bit in the status register. 8.22 brk instruction the brk instruction for the nmos 6502, 65c02 and 65c816 is actually a 2 byte instruction. the nmos device simply skips the sec ond byte (i.e. doesn?t care about the second byte) by incrementing the program counter twice. the 65c02 and 65c816 does the same thing except the assembler is looking for the second byte as a ?signature byte?. with either device (nmos or cmos), the secon d byte is not used. it is important to realize that if a return from interrupt is used it will return to the location after the second or signature byte. 8.23 accumulator switching from 8 bit to 16 bit care must be taken when switching from 16 bit mode to 8 bit mode then to 16 bit mode. the b register is restored so that the following code shows a potential problem: longa on rep #$20 lda #$2345 sta mike longa pff sep #$20 lda #$01 sta sam longa on rep #$20 sta bob here bob = $2301 and not $000v
the western design center, inc. W65C816S data sheet the western design center W65C816S 61 9 hard core model 9.1 w65c816 core information the W65C816S core uses the same instruction set as the W65C816S the only functional difference between the W65C816S and W65C816S core is the rdy pin. the W65C816S rdy pin is bi - directional utilizing an active pull - up. the W65C816S core rdy function is split into 2 pins, rdyin and waitn. the waitn output goes low when a wai instruction is executed. the W65C816S core will be a smaller die since the i/o buffers have been removed. the outputs are the n - chann el and p - channel output transistors drivers. the following inputs, if not used, must be held in the high state: rdy input, irqb, mib, be and abortb. the timing of the W65C816S core is the same as the W65C816S. 10 soft core rtl model 10.1 w65c816 synthesizabl e rtl - code in verilog hdl the rtl - code ( r egister t ransfer l evel) in verilog is a synthesizable model. the behavior of this model is equivalent to the original W65C816S hard core. the W65C816S rtl - code is available as the core model and the W65C816S stan dard chip model. the standard chip model includes the soft core and the buffer ring in rtl - code. synthesizable cores are useful in asic design.
the western design center, inc. W65C816S data sheet the western design center W65C816S 62 11 ordering information W65C816S6pl - 14 description w65c w65c = standard product product identification nu mber 816s foundry process 6 blank = 1.2u 8 = .8u 6 = .6u package pl p = plastic dual - in - line, 40 pins pl = plastic leaded chip carrier, 44 pins q = quad flat pack, 44 pins temperature/processing dip = 0 c to + 70 c plcc and qfp = - 40 c to + 85 c speed designator - 14 - 14 = 14mhz ___________________________________________________________________________ to receive general sales or technical support on standard product or information about our module library licenses, contact us at: the wester n design center, inc. 2166 east brown road mesa, arizona 85213 usa phone: 480 - 962 - 4545 fax: 480 - 835 - 6442 information@westerndesigncenter.com www.westerndesigncenter.com ______________________________________________________________________________ warning: mos circuits are subject to damage from static discharge internal static discharge circuits are provided to minimize part damage due to environmental static electrical charge build - ups. industry established recommendations for handling mos c ircuits include: 1. ship and store product in conductive shipping tubes or conductive foam plastic. never ship or store product in non - conductive plastic containers or non - conductive plastic foam material. 2. handle mos parts only at conductive work s tations. 3. ground all assembly and repair tools.


▲Up To Search▲   

 
Price & Availability of W65C816S

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X